diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/CHANGELOG.md b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/CHANGELOG.md index 601dd330afa6..399268bebaf5 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/CHANGELOG.md +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/CHANGELOG.md @@ -1,5 +1,31 @@ # Release History +## 1.0.0 (2026-02-26) + +### Features Added + + - Client `DisconnectedOperationsMgmtClient` added operation group `hardware_settings` + - Model `DisconnectedOperationDeploymentManifest` added property `billing_configuration` + - Model `DisconnectedOperationDeploymentManifest` added property `benefit_plans` + - Model `DisconnectedOperationProperties` added property `billing_configuration` + - Model `DisconnectedOperationProperties` added property `benefit_plans` + - Model `DisconnectedOperationUpdateProperties` added property `billing_configuration` + - Model `DisconnectedOperationUpdateProperties` added property `benefit_plans` + - Model `ImageDownloadResult` added property `update_properties` + - Model `ImageProperties` added property `update_properties` + - Added enum `AutoRenew` + - Added enum `BenefitPlanStatus` + - Added model `BenefitPlans` + - Added model `BillingConfiguration` + - Added model `BillingPeriod` + - Added enum `BillingStatus` + - Added model `HardwareSetting` + - Added model `HardwareSettingProperties` + - Added model `ImageUpdateProperties` + - Added enum `PricingModel` + - Added enum `SystemReboot` + - Added operation group `HardwareSettingsOperations` + ## 1.0.0b2 (2025-10-09) ### Bugs Fixed diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/_metadata.json b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/_metadata.json index f7297b7acfd3..3f1fc556d155 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/_metadata.json +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/_metadata.json @@ -1,7 +1,10 @@ { - "apiVersion": "2025-06-01-preview", - "commit": "23e8495fba7c3a1ef9ac40cc6317ac29db76130d", + "apiVersion": "2026-03-15", + "apiVersions": { + "Microsoft.Edge": "2026-03-15" + }, + "commit": "13527a197ab5b1366442ab8306608e44ae923e95", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/edge/Microsoft.Edge.DisconnectedOperations.Management", - "emitterVersion": "0.50.0" + "emitterVersion": "0.60.1" } \ No newline at end of file diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/apiview-properties.json b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/apiview-properties.json index 25aac0c6cb9f..3e36dbfd6909 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/apiview-properties.json +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/apiview-properties.json @@ -6,6 +6,9 @@ "azure.mgmt.disconnectedoperations.models.Artifact": "Microsoft.Edge.Artifact", "azure.mgmt.disconnectedoperations.models.ArtifactDownloadResult": "Microsoft.Edge.ArtifactDownloadResult", "azure.mgmt.disconnectedoperations.models.ArtifactProperties": "Microsoft.Edge.ArtifactProperties", + "azure.mgmt.disconnectedoperations.models.BenefitPlans": "Microsoft.Edge.BenefitPlans", + "azure.mgmt.disconnectedoperations.models.BillingConfiguration": "Microsoft.Edge.BillingConfiguration", + "azure.mgmt.disconnectedoperations.models.BillingPeriod": "Microsoft.Edge.BillingPeriod", "azure.mgmt.disconnectedoperations.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", "azure.mgmt.disconnectedoperations.models.DisconnectedOperation": "Microsoft.Edge.DisconnectedOperation", "azure.mgmt.disconnectedoperations.models.DisconnectedOperationDeploymentManifest": "Microsoft.Edge.DisconnectedOperationDeploymentManifest", @@ -15,9 +18,12 @@ "azure.mgmt.disconnectedoperations.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", "azure.mgmt.disconnectedoperations.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", "azure.mgmt.disconnectedoperations.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.disconnectedoperations.models.HardwareSetting": "Microsoft.Edge.HardwareSetting", + "azure.mgmt.disconnectedoperations.models.HardwareSettingProperties": "Microsoft.Edge.HardwareSettingProperties", "azure.mgmt.disconnectedoperations.models.Image": "Microsoft.Edge.Image", "azure.mgmt.disconnectedoperations.models.ImageDownloadResult": "Microsoft.Edge.ImageDownloadResult", "azure.mgmt.disconnectedoperations.models.ImageProperties": "Microsoft.Edge.ImageProperties", + "azure.mgmt.disconnectedoperations.models.ImageUpdateProperties": "Microsoft.Edge.ImageUpdateProperties", "azure.mgmt.disconnectedoperations.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", "azure.mgmt.disconnectedoperations.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", "azure.mgmt.disconnectedoperations.models.ResourceProvisioningState": "Azure.ResourceManager.ResourceProvisioningState", @@ -25,7 +31,12 @@ "azure.mgmt.disconnectedoperations.models.ConnectionIntent": "Microsoft.Edge.ConnectionIntent", "azure.mgmt.disconnectedoperations.models.ConnectionStatus": "Microsoft.Edge.ConnectionStatus", "azure.mgmt.disconnectedoperations.models.RegistrationStatus": "Microsoft.Edge.RegistrationStatus", + "azure.mgmt.disconnectedoperations.models.AutoRenew": "Microsoft.Edge.AutoRenew", + "azure.mgmt.disconnectedoperations.models.BillingStatus": "Microsoft.Edge.BillingStatus", + "azure.mgmt.disconnectedoperations.models.PricingModel": "Microsoft.Edge.PricingModel", + "azure.mgmt.disconnectedoperations.models.BenefitPlanStatus": "Microsoft.Edge.BenefitPlanStatus", "azure.mgmt.disconnectedoperations.models.ReleaseType": "Microsoft.Edge.ReleaseType", + "azure.mgmt.disconnectedoperations.models.SystemReboot": "Microsoft.Edge.SystemReboot", "azure.mgmt.disconnectedoperations.operations.DisconnectedOperationsOperations.get": "Microsoft.Edge.DisconnectedOperations.get", "azure.mgmt.disconnectedoperations.aio.operations.DisconnectedOperationsOperations.get": "Microsoft.Edge.DisconnectedOperations.get", "azure.mgmt.disconnectedoperations.operations.DisconnectedOperationsOperations.begin_create_or_update": "Microsoft.Edge.DisconnectedOperations.createOrUpdate", @@ -51,6 +62,14 @@ "azure.mgmt.disconnectedoperations.operations.ArtifactsOperations.get": "Microsoft.Edge.Artifacts.get", "azure.mgmt.disconnectedoperations.aio.operations.ArtifactsOperations.get": "Microsoft.Edge.Artifacts.get", "azure.mgmt.disconnectedoperations.operations.ArtifactsOperations.list_download_uri": "Microsoft.Edge.Artifacts.listDownloadUri", - "azure.mgmt.disconnectedoperations.aio.operations.ArtifactsOperations.list_download_uri": "Microsoft.Edge.Artifacts.listDownloadUri" + "azure.mgmt.disconnectedoperations.aio.operations.ArtifactsOperations.list_download_uri": "Microsoft.Edge.Artifacts.listDownloadUri", + "azure.mgmt.disconnectedoperations.operations.HardwareSettingsOperations.list_by_parent": "Microsoft.Edge.HardwareSettings.listByParent", + "azure.mgmt.disconnectedoperations.aio.operations.HardwareSettingsOperations.list_by_parent": "Microsoft.Edge.HardwareSettings.listByParent", + "azure.mgmt.disconnectedoperations.operations.HardwareSettingsOperations.get": "Microsoft.Edge.HardwareSettings.get", + "azure.mgmt.disconnectedoperations.aio.operations.HardwareSettingsOperations.get": "Microsoft.Edge.HardwareSettings.get", + "azure.mgmt.disconnectedoperations.operations.HardwareSettingsOperations.begin_create_or_update": "Microsoft.Edge.HardwareSettings.createOrUpdate", + "azure.mgmt.disconnectedoperations.aio.operations.HardwareSettingsOperations.begin_create_or_update": "Microsoft.Edge.HardwareSettings.createOrUpdate", + "azure.mgmt.disconnectedoperations.operations.HardwareSettingsOperations.begin_delete": "Microsoft.Edge.HardwareSettings.delete", + "azure.mgmt.disconnectedoperations.aio.operations.HardwareSettingsOperations.begin_delete": "Microsoft.Edge.HardwareSettings.delete" } } \ No newline at end of file diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_client.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_client.py index 7a598b9164d2..b724a259ded7 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_client.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_client.py @@ -19,7 +19,12 @@ from ._configuration import DisconnectedOperationsMgmtClientConfiguration from ._utils.serialization import Deserializer, Serializer -from .operations import ArtifactsOperations, DisconnectedOperationsOperations, ImagesOperations +from .operations import ( + ArtifactsOperations, + DisconnectedOperationsOperations, + HardwareSettingsOperations, + ImagesOperations, +) if TYPE_CHECKING: from azure.core import AzureClouds @@ -36,6 +41,9 @@ class DisconnectedOperationsMgmtClient: :vartype images: azure.mgmt.disconnectedoperations.operations.ImagesOperations :ivar artifacts: ArtifactsOperations operations :vartype artifacts: azure.mgmt.disconnectedoperations.operations.ArtifactsOperations + :ivar hardware_settings: HardwareSettingsOperations operations + :vartype hardware_settings: + azure.mgmt.disconnectedoperations.operations.HardwareSettingsOperations :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. @@ -45,9 +53,9 @@ class DisconnectedOperationsMgmtClient: :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: The API version to use for this operation. Default value is - "2025-06-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are "2026-03-15" + and None. Default value is "2026-03-15". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -105,6 +113,9 @@ def __init__( ) self.images = ImagesOperations(self._client, self._config, self._serialize, self._deserialize) self.artifacts = ArtifactsOperations(self._client, self._config, self._serialize, self._deserialize) + self.hardware_settings = HardwareSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) 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/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_configuration.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_configuration.py index f29f084a8069..50828a31f334 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_configuration.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_configuration.py @@ -33,9 +33,9 @@ class DisconnectedOperationsMgmtClientConfiguration: # pylint: disable=too-many :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: The API version to use for this operation. Default value is - "2025-06-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are "2026-03-15" + and None. Default value is "2026-03-15". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str """ @@ -47,7 +47,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-06-01-preview") + api_version: str = kwargs.pop("api_version", "2026-03-15") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_utils/model_base.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_utils/model_base.py index 12926fa98dcf..c402af2afc63 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_utils/model_base.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_utils/model_base.py @@ -37,6 +37,7 @@ TZ_UTC = timezone.utc _T = typing.TypeVar("_T") +_NONE_TYPE = type(None) def _timedelta_as_isostr(td: timedelta) -> str: @@ -171,6 +172,21 @@ def default(self, o): # pylint: disable=too-many-return-statements r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" ) +_ARRAY_ENCODE_MAPPING = { + "pipeDelimited": "|", + "spaceDelimited": " ", + "commaDelimited": ",", + "newlineDelimited": "\n", +} + + +def _deserialize_array_encoded(delimit: str, attr): + if isinstance(attr, str): + if attr == "": + return [] + return attr.split(delimit) + return attr + def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: """Deserialize ISO-8601 formatted string into Datetime object. @@ -202,7 +218,7 @@ def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: test_utc = date_obj.utctimetuple() if test_utc.tm_year > 9999 or test_utc.tm_year < 1: raise OverflowError("Hit max or min date") - return date_obj + return date_obj # type: ignore[no-any-return] def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: @@ -256,7 +272,7 @@ def _deserialize_time(attr: typing.Union[str, time]) -> time: """ if isinstance(attr, time): return attr - return isodate.parse_time(attr) + return isodate.parse_time(attr) # type: ignore[no-any-return] def _deserialize_bytes(attr): @@ -315,6 +331,8 @@ def _deserialize_int_as_str(attr): def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): if annotation is int and rf and rf._format == "str": return _deserialize_int_as_str + if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: + return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) if rf and rf._format: return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore @@ -353,9 +371,39 @@ def __contains__(self, key: typing.Any) -> bool: return key in self._data def __getitem__(self, key: str) -> typing.Any: + # If this key has been deserialized (for mutable types), we need to handle serialization + if hasattr(self, "_attr_to_rest_field"): + cache_attr = f"_deserialized_{key}" + if hasattr(self, cache_attr): + rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) + if rf: + value = self._data.get(key) + if isinstance(value, (dict, list, set)): + # For mutable types, serialize and return + # But also update _data with serialized form and clear flag + # so mutations via this returned value affect _data + serialized = _serialize(value, rf._format) + # If serialized form is same type (no transformation needed), + # return _data directly so mutations work + if isinstance(serialized, type(value)) and serialized == value: + return self._data.get(key) + # Otherwise return serialized copy and clear flag + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + # Store serialized form back + self._data[key] = serialized + return serialized return self._data.__getitem__(key) def __setitem__(self, key: str, value: typing.Any) -> None: + # Clear any cached deserialized value when setting through dictionary access + cache_attr = f"_deserialized_{key}" + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass self._data.__setitem__(key, value) def __delitem__(self, key: str) -> None: @@ -483,6 +531,8 @@ def _is_model(obj: typing.Any) -> bool: def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements if isinstance(o, list): + if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): + return _ARRAY_ENCODE_MAPPING[format].join(o) return [_serialize(x, format) for x in o] if isinstance(o, dict): return {k: _serialize(v, format) for k, v in o.items()} @@ -758,6 +808,14 @@ def _deserialize_multiple_sequence( return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) +def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: + return ( + isinstance(deserializer, functools.partial) + and isinstance(deserializer.args[0], functools.partial) + and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable + ) + + def _deserialize_sequence( deserializer: typing.Optional[typing.Callable], module: typing.Optional[str], @@ -767,6 +825,19 @@ def _deserialize_sequence( return obj if isinstance(obj, ET.Element): obj = list(obj) + + # encoded string may be deserialized to sequence + if isinstance(obj, str) and isinstance(deserializer, functools.partial): + # for list[str] + if _is_array_encoded_deserializer(deserializer): + return deserializer(obj) + + # for list[Union[...]] + if isinstance(deserializer.args[0], list): + for sub_deserializer in deserializer.args[0]: + if _is_array_encoded_deserializer(sub_deserializer): + return sub_deserializer(obj) + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) @@ -817,16 +888,16 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur # is it optional? try: - if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore + if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore if len(annotation.__args__) <= 2: # pyright: ignore if_obj_deserializer = _get_deserialize_callable_from_annotation( - next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore + next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore ) return functools.partial(_deserialize_with_optional, if_obj_deserializer) # the type is Optional[Union[...]], we need to remove the None type from the Union annotation_copy = copy.copy(annotation) - annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) except AttributeError: pass @@ -952,7 +1023,7 @@ def _failsafe_deserialize( ) -> typing.Any: try: return _deserialize(deserializer, response.json(), module, rf, format) - except DeserializationError: + except Exception: # pylint: disable=broad-except _LOGGER.warning( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -965,7 +1036,7 @@ def _failsafe_deserialize_xml( ) -> typing.Any: try: return _deserialize_xml(deserializer, response.text()) - except DeserializationError: + except Exception: # pylint: disable=broad-except _LOGGER.warning( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -998,7 +1069,11 @@ def __init__( @property def _class_type(self) -> typing.Any: - return getattr(self._type, "args", [None])[0] + result = getattr(self._type, "args", [None])[0] + # type may be wrapped by nested functools.partial so we need to check for that + if isinstance(result, functools.partial): + return getattr(result, "args", [None])[0] + return result @property def _rest_name(self) -> str: @@ -1009,14 +1084,37 @@ def _rest_name(self) -> str: def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin # by this point, type and rest_name will have a value bc we default # them in __new__ of the Model class - item = obj.get(self._rest_name) + # Use _data.get() directly to avoid triggering __getitem__ which clears the cache + item = obj._data.get(self._rest_name) if item is None: return item if self._is_model: return item - return _deserialize(self._type, _serialize(item, self._format), rf=self) + + # For mutable types, we want mutations to directly affect _data + # Check if we've already deserialized this value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + # Return the value from _data directly (it's been deserialized in place) + return obj._data.get(self._rest_name) + + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + + # For mutable types, store the deserialized value back in _data + # so mutations directly affect _data + if isinstance(deserialized, (dict, list, set)): + obj._data[self._rest_name] = deserialized + object.__setattr__(obj, cache_attr, True) # Mark as deserialized + return deserialized + + return deserialized def __set__(self, obj: Model, value) -> None: + # Clear the cached deserialized object when setting a new value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + object.__delattr__(obj, cache_attr) + if value is None: # we want to wipe out entries if users set attr to None try: @@ -1184,7 +1282,7 @@ def _get_wrapped_element( _get_element(v, exclude_readonly, meta, wrapped_element) else: wrapped_element.text = _get_primitive_type_value(v) - return wrapped_element + return wrapped_element # type: ignore[no-any-return] def _get_primitive_type_value(v) -> str: @@ -1197,7 +1295,9 @@ def _get_primitive_type_value(v) -> str: return str(v) -def _create_xml_element(tag, prefix=None, ns=None): +def _create_xml_element( + tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None +) -> ET.Element: if prefix and ns: ET.register_namespace(prefix, ns) if ns: diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_utils/serialization.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_utils/serialization.py index e81921cbb011..81ec1de5922b 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_utils/serialization.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_utils/serialization.py @@ -787,7 +787,7 @@ def serialize_data(self, data, data_type, **kwargs): # If dependencies is empty, try with current data class # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) if issubclass(enum_type, Enum): return Serializer.serialize_enum(data, enum_obj=enum_type) @@ -821,13 +821,20 @@ def serialize_basic(cls, data, data_type, **kwargs): :param str data_type: Type of object in the iterable. :rtype: str, int, float, bool :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) @classmethod def serialize_unicode(cls, data): @@ -1757,7 +1764,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 or data_type is not one of str, int, float, bool. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1783,7 +1790,11 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) @staticmethod def deserialize_unicode(data): diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_validation.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_validation.py new file mode 100644 index 000000000000..f5af3a4eb8a2 --- /dev/null +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_validation.py @@ -0,0 +1,66 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools + + +def api_version_validation(**kwargs): + params_added_on = kwargs.pop("params_added_on", {}) + method_added_on = kwargs.pop("method_added_on", "") + api_versions_list = kwargs.pop("api_versions_list", []) + + def _index_with_default(value: str, default: int = -1) -> int: + """Get the index of value in lst, or return default if not found. + + :param value: The value to search for in the api_versions_list. + :type value: str + :param default: The default value to return if the value is not found. + :type default: int + :return: The index of the value in the list, or the default value if not found. + :rtype: int + """ + try: + return api_versions_list.index(value) + except ValueError: + return default + + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + # this assumes the client has an _api_version attribute + client = args[0] + client_api_version = client._config.api_version # pylint: disable=protected-access + except AttributeError: + return func(*args, **kwargs) + + if _index_with_default(method_added_on) > _index_with_default(client_api_version): + raise ValueError( + f"'{func.__name__}' is not available in API version " + f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." + ) + + unsupported = { + parameter: api_version + for api_version, parameters in params_added_on.items() + for parameter in parameters + if parameter in kwargs and _index_with_default(api_version) > _index_with_default(client_api_version) + } + if unsupported: + raise ValueError( + "".join( + [ + f"'{param}' is not available in API version {client_api_version}. " + f"Use service API version {version} or newer.\n" + for param, version in unsupported.items() + ] + ) + ) + return func(*args, **kwargs) + + return wrapper + + return decorator diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_version.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_version.py index bbcd28b4aa67..0ec13ea52bbf 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_version.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0" diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/aio/_client.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/aio/_client.py index 0cb8258df70d..16e91fe85d17 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/aio/_client.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/aio/_client.py @@ -19,7 +19,12 @@ from .._utils.serialization import Deserializer, Serializer from ._configuration import DisconnectedOperationsMgmtClientConfiguration -from .operations import ArtifactsOperations, DisconnectedOperationsOperations, ImagesOperations +from .operations import ( + ArtifactsOperations, + DisconnectedOperationsOperations, + HardwareSettingsOperations, + ImagesOperations, +) if TYPE_CHECKING: from azure.core import AzureClouds @@ -36,6 +41,9 @@ class DisconnectedOperationsMgmtClient: :vartype images: azure.mgmt.disconnectedoperations.aio.operations.ImagesOperations :ivar artifacts: ArtifactsOperations operations :vartype artifacts: azure.mgmt.disconnectedoperations.aio.operations.ArtifactsOperations + :ivar hardware_settings: HardwareSettingsOperations operations + :vartype hardware_settings: + azure.mgmt.disconnectedoperations.aio.operations.HardwareSettingsOperations :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. @@ -45,9 +53,9 @@ class DisconnectedOperationsMgmtClient: :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: The API version to use for this operation. Default value is - "2025-06-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are "2026-03-15" + and None. Default value is "2026-03-15". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -107,6 +115,9 @@ def __init__( ) self.images = ImagesOperations(self._client, self._config, self._serialize, self._deserialize) self.artifacts = ArtifactsOperations(self._client, self._config, self._serialize, self._deserialize) + self.hardware_settings = HardwareSettingsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/aio/_configuration.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/aio/_configuration.py index 86c7b5a20891..c9b596a99df1 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/aio/_configuration.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/aio/_configuration.py @@ -33,9 +33,9 @@ class DisconnectedOperationsMgmtClientConfiguration: # pylint: disable=too-many :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: The API version to use for this operation. Default value is - "2025-06-01-preview". Note that overriding this default value may result in unsupported - behavior. + :keyword api_version: The API version to use for this operation. Known values are "2026-03-15" + and None. Default value is "2026-03-15". Note that overriding this default value may result in + unsupported behavior. :paramtype api_version: str """ @@ -47,7 +47,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2025-06-01-preview") + api_version: str = kwargs.pop("api_version", "2026-03-15") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/aio/operations/__init__.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/aio/operations/__init__.py index 6488834751cb..01adb47a73d3 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/aio/operations/__init__.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/aio/operations/__init__.py @@ -15,6 +15,7 @@ from ._operations import DisconnectedOperationsOperations # type: ignore from ._operations import ImagesOperations # type: ignore from ._operations import ArtifactsOperations # type: ignore +from ._operations import HardwareSettingsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -24,6 +25,7 @@ "DisconnectedOperationsOperations", "ImagesOperations", "ArtifactsOperations", + "HardwareSettingsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/aio/operations/_operations.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/aio/operations/_operations.py index 601e34932799..ab2ac13a2cb5 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/aio/operations/_operations.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/aio/operations/_operations.py @@ -36,6 +36,7 @@ from ... import models as _models from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Deserializer, Serializer +from ..._validation import api_version_validation from ...operations._operations import ( build_artifacts_get_request, build_artifacts_list_by_parent_request, @@ -47,6 +48,10 @@ build_disconnected_operations_list_by_subscription_request, build_disconnected_operations_list_deployment_manifest_request, build_disconnected_operations_update_request, + build_hardware_settings_create_or_update_request, + build_hardware_settings_delete_request, + build_hardware_settings_get_request, + build_hardware_settings_list_by_parent_request, build_images_get_request, build_images_list_by_disconnected_operation_request, build_images_list_download_uri_request, @@ -130,7 +135,10 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -199,7 +207,10 @@ async def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -534,7 +545,10 @@ async def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -587,7 +601,10 @@ async def _delete_initial(self, resource_group_name: str, name: str, **kwargs: A except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -743,7 +760,10 @@ 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) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -828,7 +848,10 @@ 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) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -891,7 +914,10 @@ async def list_deployment_manifest( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1027,7 +1053,10 @@ 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) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1090,7 +1119,10 @@ async def get(self, resource_group_name: str, name: str, image_name: str, **kwar except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1161,7 +1193,10 @@ async def list_download_uri( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1284,7 +1319,10 @@ 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) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1352,7 +1390,10 @@ async def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1426,7 +1467,10 @@ async def list_download_uri( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1438,3 +1482,634 @@ async def list_download_uri( return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + + +class HardwareSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.disconnectedoperations.aio.DisconnectedOperationsMgmtClient`'s + :attr:`hardware_settings` attribute. + """ + + 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: DisconnectedOperationsMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-15", + params_added_on={"2026-03-15": ["api_version", "subscription_id", "resource_group_name", "name", "accept"]}, + api_versions_list=["2026-03-15"], + ) + def list_by_parent( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.HardwareSetting"]: + """List by parent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: Name of the resource. Required. + :type name: str + :return: An iterator like instance of HardwareSetting + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.disconnectedoperations.models.HardwareSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_models.HardwareSetting]] = 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_hardware_settings_list_by_parent_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(list[_models.HardwareSetting], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15", + params_added_on={ + "2026-03-15": [ + "api_version", + "subscription_id", + "resource_group_name", + "name", + "hardware_setting_name", + "accept", + ] + }, + api_versions_list=["2026-03-15"], + ) + async def get( + self, resource_group_name: str, name: str, hardware_setting_name: str, **kwargs: Any + ) -> _models.HardwareSetting: + """Get the hardware settings resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: Name of the resource. Required. + :type name: str + :param hardware_setting_name: The name of the HardwareSetting. Required. + :type hardware_setting_name: str + :return: HardwareSetting. The HardwareSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.disconnectedoperations.models.HardwareSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.HardwareSetting] = kwargs.pop("cls", None) + + _request = build_hardware_settings_get_request( + resource_group_name=resource_group_name, + name=name, + hardware_setting_name=hardware_setting_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.HardwareSetting, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2026-03-15", + params_added_on={ + "2026-03-15": [ + "api_version", + "subscription_id", + "resource_group_name", + "name", + "hardware_setting_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15"], + ) + async def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + hardware_setting_name: str, + resource: Union[_models.HardwareSetting, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_hardware_settings_create_or_update_request( + resource_group_name=resource_group_name, + name=name, + hardware_setting_name=hardware_setting_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + hardware_setting_name: str, + resource: _models.HardwareSetting, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.HardwareSetting]: + """Create or update hardware settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: Name of the resource. Required. + :type name: str + :param hardware_setting_name: The name of the HardwareSetting. Required. + :type hardware_setting_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.disconnectedoperations.models.HardwareSetting + :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 HardwareSetting. The HardwareSetting is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.disconnectedoperations.models.HardwareSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + hardware_setting_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.HardwareSetting]: + """Create or update hardware settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: Name of the resource. Required. + :type name: str + :param hardware_setting_name: The name of the HardwareSetting. Required. + :type hardware_setting_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns HardwareSetting. The HardwareSetting is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.disconnectedoperations.models.HardwareSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + hardware_setting_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.HardwareSetting]: + """Create or update hardware settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: Name of the resource. Required. + :type name: str + :param hardware_setting_name: The name of the HardwareSetting. Required. + :type hardware_setting_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns HardwareSetting. The HardwareSetting is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.disconnectedoperations.models.HardwareSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15", + params_added_on={ + "2026-03-15": [ + "api_version", + "subscription_id", + "resource_group_name", + "name", + "hardware_setting_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15"], + ) + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + hardware_setting_name: str, + resource: Union[_models.HardwareSetting, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.HardwareSetting]: + """Create or update hardware settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: Name of the resource. Required. + :type name: str + :param hardware_setting_name: The name of the HardwareSetting. Required. + :type hardware_setting_name: str + :param resource: Resource create parameters. Is one of the following types: HardwareSetting, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.disconnectedoperations.models.HardwareSetting or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns HardwareSetting. The HardwareSetting is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.disconnectedoperations.models.HardwareSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HardwareSetting] = 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, + name=name, + hardware_setting_name=hardware_setting_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.HardwareSetting, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.HardwareSetting].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.HardwareSetting]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-03-15", + params_added_on={ + "2026-03-15": ["api_version", "subscription_id", "resource_group_name", "name", "hardware_setting_name"] + }, + api_versions_list=["2026-03-15"], + ) + async def _delete_initial( + self, resource_group_name: str, name: str, hardware_setting_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_hardware_settings_delete_request( + resource_group_name=resource_group_name, + name=name, + hardware_setting_name=hardware_setting_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-15", + params_added_on={ + "2026-03-15": ["api_version", "subscription_id", "resource_group_name", "name", "hardware_setting_name"] + }, + api_versions_list=["2026-03-15"], + ) + async def begin_delete( + self, resource_group_name: str, name: str, hardware_setting_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete hardware settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: Name of the resource. Required. + :type name: str + :param hardware_setting_name: The name of the HardwareSetting. Required. + :type hardware_setting_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + name=name, + hardware_setting_name=hardware_setting_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/models/__init__.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/models/__init__.py index 2fad479e7e5b..7d1dc3d3743b 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/models/__init__.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/models/__init__.py @@ -17,6 +17,9 @@ Artifact, ArtifactDownloadResult, ArtifactProperties, + BenefitPlans, + BillingConfiguration, + BillingPeriod, DisconnectedOperation, DisconnectedOperationDeploymentManifest, DisconnectedOperationProperties, @@ -25,9 +28,12 @@ ErrorAdditionalInfo, ErrorDetail, ErrorResponse, + HardwareSetting, + HardwareSettingProperties, Image, ImageDownloadResult, ImageProperties, + ImageUpdateProperties, ProxyResource, Resource, SystemData, @@ -35,13 +41,18 @@ ) from ._enums import ( # type: ignore + AutoRenew, + BenefitPlanStatus, BillingModel, + BillingStatus, ConnectionIntent, ConnectionStatus, CreatedByType, + PricingModel, RegistrationStatus, ReleaseType, ResourceProvisioningState, + SystemReboot, ) from ._patch import __all__ as _patch_all from ._patch import * @@ -51,6 +62,9 @@ "Artifact", "ArtifactDownloadResult", "ArtifactProperties", + "BenefitPlans", + "BillingConfiguration", + "BillingPeriod", "DisconnectedOperation", "DisconnectedOperationDeploymentManifest", "DisconnectedOperationProperties", @@ -59,20 +73,28 @@ "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", + "HardwareSetting", + "HardwareSettingProperties", "Image", "ImageDownloadResult", "ImageProperties", + "ImageUpdateProperties", "ProxyResource", "Resource", "SystemData", "TrackedResource", + "AutoRenew", + "BenefitPlanStatus", "BillingModel", + "BillingStatus", "ConnectionIntent", "ConnectionStatus", "CreatedByType", + "PricingModel", "RegistrationStatus", "ReleaseType", "ResourceProvisioningState", + "SystemReboot", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/models/_enums.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/models/_enums.py index 26c72acfbff9..031d344844d7 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/models/_enums.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/models/_enums.py @@ -10,6 +10,24 @@ from azure.core import CaseInsensitiveEnumMeta +class AutoRenew(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Auto renew status.""" + + ENABLED = "Enabled" + """Auto renew is enabled.""" + DISABLED = "Disabled" + """Auto renew is disabled.""" + + +class BenefitPlanStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Benefit plans status.""" + + ENABLED = "Enabled" + """Benefit plan is enabled.""" + DISABLED = "Disabled" + """Benefit plan is disabled.""" + + class BillingModel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Billing model.""" @@ -17,6 +35,17 @@ class BillingModel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Billed on capacity.""" +class BillingStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Billing status.""" + + ENABLED = "Enabled" + """Billing is enabled.""" + DISABLED = "Disabled" + """Billing is disabled.""" + STOPPED = "Stopped" + """Billing is stopped.""" + + class ConnectionIntent(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Connection Intent.""" @@ -48,6 +77,15 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The entity was created by a key.""" +class PricingModel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Pricing model.""" + + TRIAL = "Trial" + """Trial pricing model.""" + ANNUAL = "Annual" + """Annual pricing model.""" + + class RegistrationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Registration status.""" @@ -75,3 +113,12 @@ class ResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Resource creation failed.""" CANCELED = "Canceled" """Resource creation was canceled.""" + + +class SystemReboot(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """System Reboot.""" + + REQUIRED = "Required" + """System reboot is required.""" + NOT_REQUIRED = "NotRequired" + """System reboot is not required.""" diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/models/_models.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/models/_models.py index 24d1c41fc5ce..c173b79fb7b5 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/models/_models.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/models/_models.py @@ -1,4 +1,4 @@ -# pylint: disable=line-too-long,useless-suppression +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -173,6 +173,134 @@ class ArtifactProperties(_Model): """The artifact size in MB.""" +class BenefitPlans(_Model): + """The benefit plans. + + :ivar azure_hybrid_windows_server_benefit: Azure Hybrid Windows Server Benefit plan. Known + values are: "Enabled" and "Disabled". + :vartype azure_hybrid_windows_server_benefit: str or + ~azure.mgmt.disconnectedoperations.models.BenefitPlanStatus + :ivar windows_server_vm_count: Number of Windows Server VMs to license under the Azure Hybrid + Benefit plan. + :vartype windows_server_vm_count: int + """ + + azure_hybrid_windows_server_benefit: Optional[Union[str, "_models.BenefitPlanStatus"]] = rest_field( + name="azureHybridWindowsServerBenefit", visibility=["read", "create", "update", "delete", "query"] + ) + """Azure Hybrid Windows Server Benefit plan. Known values are: \"Enabled\" and \"Disabled\".""" + windows_server_vm_count: Optional[int] = rest_field( + name="windowsServerVmCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Number of Windows Server VMs to license under the Azure Hybrid Benefit plan.""" + + @overload + def __init__( + self, + *, + azure_hybrid_windows_server_benefit: Optional[Union[str, "_models.BenefitPlanStatus"]] = None, + windows_server_vm_count: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BillingConfiguration(_Model): + """The billing configuration. + + :ivar auto_renew: The auto renew setting. Required. Known values are: "Enabled" and "Disabled". + :vartype auto_renew: str or ~azure.mgmt.disconnectedoperations.models.AutoRenew + :ivar billing_status: The billing status. Required. Known values are: "Enabled", "Disabled", + and "Stopped". + :vartype billing_status: str or ~azure.mgmt.disconnectedoperations.models.BillingStatus + :ivar current: The current billing configuration. Required. + :vartype current: ~azure.mgmt.disconnectedoperations.models.BillingPeriod + :ivar upcoming: The upcoming billing configuration. + :vartype upcoming: ~azure.mgmt.disconnectedoperations.models.BillingPeriod + """ + + auto_renew: Union[str, "_models.AutoRenew"] = rest_field( + name="autoRenew", visibility=["read", "create", "update", "delete", "query"] + ) + """The auto renew setting. Required. Known values are: \"Enabled\" and \"Disabled\".""" + billing_status: Union[str, "_models.BillingStatus"] = rest_field(name="billingStatus", visibility=["read"]) + """The billing status. Required. Known values are: \"Enabled\", \"Disabled\", and \"Stopped\".""" + current: "_models.BillingPeriod" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The current billing configuration. Required.""" + upcoming: Optional["_models.BillingPeriod"] = rest_field(visibility=["read", "update"]) + """The upcoming billing configuration.""" + + @overload + def __init__( + self, + *, + auto_renew: Union[str, "_models.AutoRenew"], + current: "_models.BillingPeriod", + upcoming: Optional["_models.BillingPeriod"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BillingPeriod(_Model): + """The billing period. + + :ivar cores: The number of cores. Required. + :vartype cores: int + :ivar pricing_model: The pricing model. Required. Known values are: "Trial" and "Annual". + :vartype pricing_model: str or ~azure.mgmt.disconnectedoperations.models.PricingModel + :ivar start_date: The billing start date. + :vartype start_date: ~datetime.date + :ivar end_date: The billing end date. + :vartype end_date: ~datetime.date + """ + + cores: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of cores. Required.""" + pricing_model: Union[str, "_models.PricingModel"] = rest_field( + name="pricingModel", visibility=["read", "create", "update", "delete", "query"] + ) + """The pricing model. Required. Known values are: \"Trial\" and \"Annual\".""" + start_date: Optional[datetime.date] = rest_field(name="startDate", visibility=["read"]) + """The billing start date.""" + end_date: Optional[datetime.date] = rest_field(name="endDate", visibility=["read"]) + """The billing end date.""" + + @overload + def __init__( + self, + *, + cores: int, + pricing_model: Union[str, "_models.PricingModel"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class TrackedResource(Resource): """Tracked Resource. @@ -282,6 +410,10 @@ class DisconnectedOperationDeploymentManifest(_Model): :vartype connection_intent: str or ~azure.mgmt.disconnectedoperations.models.ConnectionIntent :ivar cloud: The cloud in which the resource is registered. :vartype cloud: str + :ivar billing_configuration: The billing configuration. + :vartype billing_configuration: ~azure.mgmt.disconnectedoperations.models.BillingConfiguration + :ivar benefit_plans: The benefit plans. + :vartype benefit_plans: ~azure.mgmt.disconnectedoperations.models.BenefitPlans """ resource_id: str = rest_field(name="resourceId", visibility=["read"]) @@ -298,6 +430,12 @@ class DisconnectedOperationDeploymentManifest(_Model): """The connection intent. Required. Known values are: \"Connected\" and \"Disconnected\".""" cloud: Optional[str] = rest_field(visibility=["read"]) """The cloud in which the resource is registered.""" + billing_configuration: Optional["_models.BillingConfiguration"] = rest_field( + name="billingConfiguration", visibility=["read"] + ) + """The billing configuration.""" + benefit_plans: Optional["_models.BenefitPlans"] = rest_field(name="benefitPlans", visibility=["read"]) + """The benefit plans.""" class DisconnectedOperationProperties(_Model): @@ -323,6 +461,10 @@ class DisconnectedOperationProperties(_Model): ~azure.mgmt.disconnectedoperations.models.RegistrationStatus :ivar device_version: The device version. :vartype device_version: str + :ivar billing_configuration: The billing configuration. + :vartype billing_configuration: ~azure.mgmt.disconnectedoperations.models.BillingConfiguration + :ivar benefit_plans: The benefit plans. + :vartype benefit_plans: ~azure.mgmt.disconnectedoperations.models.BenefitPlans """ provisioning_state: Optional[Union[str, "_models.ResourceProvisioningState"]] = rest_field( @@ -334,7 +476,7 @@ class DisconnectedOperationProperties(_Model): billing_model: Union[str, "_models.BillingModel"] = rest_field(name="billingModel", visibility=["read"]) """The billing model. Required. \"Capacity\"""" connection_intent: Union[str, "_models.ConnectionIntent"] = rest_field( - name="connectionIntent", visibility=["read", "create", "update", "delete", "query"] + name="connectionIntent", visibility=["read", "create", "update"] ) """The connection intent. Required. Known values are: \"Connected\" and \"Disconnected\".""" connection_status: Optional[Union[str, "_models.ConnectionStatus"]] = rest_field( @@ -347,6 +489,14 @@ class DisconnectedOperationProperties(_Model): """The registration intent. Known values are: \"Registered\" and \"Unregistered\".""" device_version: Optional[str] = rest_field(name="deviceVersion", visibility=["read", "update"]) """The device version.""" + billing_configuration: Optional["_models.BillingConfiguration"] = rest_field( + name="billingConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The billing configuration.""" + benefit_plans: Optional["_models.BenefitPlans"] = rest_field( + name="benefitPlans", visibility=["read", "create", "update", "delete", "query"] + ) + """The benefit plans.""" @overload def __init__( @@ -355,6 +505,8 @@ def __init__( connection_intent: Union[str, "_models.ConnectionIntent"], registration_status: Optional[Union[str, "_models.RegistrationStatus"]] = None, device_version: Optional[str] = None, + billing_configuration: Optional["_models.BillingConfiguration"] = None, + benefit_plans: Optional["_models.BenefitPlans"] = None, ) -> None: ... @overload @@ -416,10 +568,14 @@ class DisconnectedOperationUpdateProperties(_Model): ~azure.mgmt.disconnectedoperations.models.RegistrationStatus :ivar device_version: The device version. :vartype device_version: str + :ivar billing_configuration: The billing configuration. + :vartype billing_configuration: ~azure.mgmt.disconnectedoperations.models.BillingConfiguration + :ivar benefit_plans: The benefit plans. + :vartype benefit_plans: ~azure.mgmt.disconnectedoperations.models.BenefitPlans """ connection_intent: Optional[Union[str, "_models.ConnectionIntent"]] = rest_field( - name="connectionIntent", visibility=["read", "create", "update", "delete", "query"] + name="connectionIntent", visibility=["read", "create", "update"] ) """The connection intent. Known values are: \"Connected\" and \"Disconnected\".""" registration_status: Optional[Union[str, "_models.RegistrationStatus"]] = rest_field( @@ -428,6 +584,14 @@ class DisconnectedOperationUpdateProperties(_Model): """The registration intent. Known values are: \"Registered\" and \"Unregistered\".""" device_version: Optional[str] = rest_field(name="deviceVersion", visibility=["read", "update"]) """The device version.""" + billing_configuration: Optional["_models.BillingConfiguration"] = rest_field( + name="billingConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The billing configuration.""" + benefit_plans: Optional["_models.BenefitPlans"] = rest_field( + name="benefitPlans", visibility=["read", "create", "update", "delete", "query"] + ) + """The benefit plans.""" @overload def __init__( @@ -436,6 +600,8 @@ def __init__( connection_intent: Optional[Union[str, "_models.ConnectionIntent"]] = None, registration_status: Optional[Union[str, "_models.RegistrationStatus"]] = None, device_version: Optional[str] = None, + billing_configuration: Optional["_models.BillingConfiguration"] = None, + benefit_plans: Optional["_models.BenefitPlans"] = None, ) -> None: ... @overload @@ -521,6 +687,127 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class HardwareSetting(ProxyResource): + """Hardware settings resource. + + :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.disconnectedoperations.models.SystemData + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.disconnectedoperations.models.HardwareSettingProperties + """ + + properties: Optional["_models.HardwareSettingProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.HardwareSettingProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class HardwareSettingProperties(_Model): + """The hardware setting properties. + + :ivar provisioning_state: The resource provisioning state. Known values are: "Succeeded", + "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.disconnectedoperations.models.ResourceProvisioningState + :ivar total_cores: The total number of cores. Required. + :vartype total_cores: int + :ivar disk_space_in_gb: The disk space in GB. Required. + :vartype disk_space_in_gb: int + :ivar memory_in_gb: The memory in GB. Required. + :vartype memory_in_gb: int + :ivar oem: The OEM. Required. + :vartype oem: str + :ivar hardware_sku: The hardware SKU. Required. + :vartype hardware_sku: str + :ivar nodes: The number of nodes. Required. + :vartype nodes: int + :ivar version_at_registration: The active version at registration. Required. + :vartype version_at_registration: str + :ivar solution_builder_extension: The solution builder extension at registration. Required. + :vartype solution_builder_extension: str + :ivar device_id: The unique Id of the device. Required. + :vartype device_id: str + """ + + provisioning_state: Optional[Union[str, "_models.ResourceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The resource provisioning state. Known values are: \"Succeeded\", \"Failed\", and \"Canceled\".""" + total_cores: int = rest_field(name="totalCores", visibility=["read", "create", "update", "delete", "query"]) + """The total number of cores. Required.""" + disk_space_in_gb: int = rest_field(name="diskSpaceInGb", visibility=["read", "create", "update", "delete", "query"]) + """The disk space in GB. Required.""" + memory_in_gb: int = rest_field(name="memoryInGb", visibility=["read", "create", "update", "delete", "query"]) + """The memory in GB. Required.""" + oem: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The OEM. Required.""" + hardware_sku: str = rest_field(name="hardwareSku", visibility=["read", "create", "update", "delete", "query"]) + """The hardware SKU. Required.""" + nodes: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of nodes. Required.""" + version_at_registration: str = rest_field( + name="versionAtRegistration", visibility=["read", "create", "update", "delete", "query"] + ) + """The active version at registration. Required.""" + solution_builder_extension: str = rest_field( + name="solutionBuilderExtension", visibility=["read", "create", "update", "delete", "query"] + ) + """The solution builder extension at registration. Required.""" + device_id: str = rest_field(name="deviceId", visibility=["read", "create", "update", "delete", "query"]) + """The unique Id of the device. Required.""" + + @overload + def __init__( + self, + *, + total_cores: int, + disk_space_in_gb: int, + memory_in_gb: int, + oem: str, + hardware_sku: str, + nodes: int, + version_at_registration: str, + solution_builder_extension: str, + device_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class Image(ProxyResource): """Holds the release information of a disconnected operations image. @@ -581,6 +868,8 @@ class ImageDownloadResult(_Model): :vartype release_type: str or ~azure.mgmt.disconnectedoperations.models.ReleaseType :ivar compatible_versions: The versions that are compatible for this update package. :vartype compatible_versions: list[str] + :ivar update_properties: Image update properties for update release type image. + :vartype update_properties: ~azure.mgmt.disconnectedoperations.models.ImageUpdateProperties :ivar transaction_id: The unique identifier of the download. Required. :vartype transaction_id: str :ivar download_link: The download URI. Required. @@ -605,6 +894,10 @@ class ImageDownloadResult(_Model): """The release type. Required. Known values are: \"Install\" and \"Update\".""" compatible_versions: Optional[list[str]] = rest_field(name="compatibleVersions", visibility=["read"]) """The versions that are compatible for this update package.""" + update_properties: Optional["_models.ImageUpdateProperties"] = rest_field( + name="updateProperties", visibility=["read"] + ) + """Image update properties for update release type image.""" transaction_id: str = rest_field(name="transactionId", visibility=["read"]) """The unique identifier of the download. Required.""" download_link: str = rest_field(name="downloadLink", visibility=["read"]) @@ -632,6 +925,8 @@ class ImageProperties(_Model): :vartype release_type: str or ~azure.mgmt.disconnectedoperations.models.ReleaseType :ivar compatible_versions: The versions that are compatible for this update package. :vartype compatible_versions: list[str] + :ivar update_properties: Image update properties for update release type image. + :vartype update_properties: ~azure.mgmt.disconnectedoperations.models.ImageUpdateProperties """ provisioning_state: Optional[Union[str, "_models.ResourceProvisioningState"]] = rest_field( @@ -650,6 +945,40 @@ class ImageProperties(_Model): """The release type. Required. Known values are: \"Install\" and \"Update\".""" compatible_versions: Optional[list[str]] = rest_field(name="compatibleVersions", visibility=["read"]) """The versions that are compatible for this update package.""" + update_properties: Optional["_models.ImageUpdateProperties"] = rest_field( + name="updateProperties", visibility=["read"] + ) + """Image update properties for update release type image.""" + + +class ImageUpdateProperties(_Model): + """The update properties of the Update Release type Image. + + :ivar system_reboot: Indicates if a system reboot is required after applying the update. + Required. Known values are: "Required" and "NotRequired". + :vartype system_reboot: str or ~azure.mgmt.disconnectedoperations.models.SystemReboot + :ivar security_updates: Details of security updates included in this image release. Required. + :vartype security_updates: str + :ivar os_version: The operating system version provided by this image update. Required. + :vartype os_version: str + :ivar agent_version: The version(s) of the agent software included in this image update. + Required. + :vartype agent_version: str + :ivar feature_updates: Details of feature updates included in this image release. Required. + :vartype feature_updates: str + """ + + system_reboot: Union[str, "_models.SystemReboot"] = rest_field(name="systemReboot", visibility=["read"]) + """Indicates if a system reboot is required after applying the update. Required. Known values are: + \"Required\" and \"NotRequired\".""" + security_updates: str = rest_field(name="securityUpdates", visibility=["read"]) + """Details of security updates included in this image release. Required.""" + os_version: str = rest_field(name="osVersion", visibility=["read"]) + """The operating system version provided by this image update. Required.""" + agent_version: str = rest_field(name="agentVersion", visibility=["read"]) + """The version(s) of the agent software included in this image update. Required.""" + feature_updates: str = rest_field(name="featureUpdates", visibility=["read"]) + """Details of feature updates included in this image release. Required.""" class SystemData(_Model): diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/operations/__init__.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/operations/__init__.py index 6488834751cb..01adb47a73d3 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/operations/__init__.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/operations/__init__.py @@ -15,6 +15,7 @@ from ._operations import DisconnectedOperationsOperations # type: ignore from ._operations import ImagesOperations # type: ignore from ._operations import ArtifactsOperations # type: ignore +from ._operations import HardwareSettingsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -24,6 +25,7 @@ "DisconnectedOperationsOperations", "ImagesOperations", "ArtifactsOperations", + "HardwareSettingsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/operations/_operations.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/operations/_operations.py index 89b022a0e3c0..b022ffb313bf 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/operations/_operations.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/azure/mgmt/disconnectedoperations/operations/_operations.py @@ -36,6 +36,7 @@ from .._configuration import DisconnectedOperationsMgmtClientConfiguration from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Deserializer, Serializer +from .._validation import api_version_validation JSON = MutableMapping[str, Any] T = TypeVar("T") @@ -51,7 +52,7 @@ def build_disconnected_operations_get_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -80,7 +81,7 @@ def build_disconnected_operations_create_or_update_request( # pylint: disable=n _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +112,7 @@ def build_disconnected_operations_update_request( # pylint: disable=name-too-lo _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,7 +141,7 @@ def build_disconnected_operations_delete_request( # pylint: disable=name-too-lo ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) # Construct URL _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}" path_format_arguments = { @@ -163,7 +164,7 @@ def build_disconnected_operations_list_by_resource_group_request( # pylint: dis _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,7 +191,7 @@ def build_disconnected_operations_list_by_subscription_request( # pylint: disab _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -216,7 +217,7 @@ def build_disconnected_operations_list_deployment_manifest_request( # pylint: d _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -251,7 +252,7 @@ def build_images_list_by_disconnected_operation_request( # pylint: disable=name _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -285,7 +286,7 @@ def build_images_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -314,7 +315,7 @@ def build_images_list_download_uri_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -343,7 +344,7 @@ def build_artifacts_list_by_parent_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -372,7 +373,7 @@ def build_artifacts_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -402,7 +403,7 @@ def build_artifacts_list_download_uri_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -426,6 +427,118 @@ def build_artifacts_list_download_uri_request( # pylint: disable=name-too-long return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_hardware_settings_list_by_parent_request( # pylint: disable=name-too-long + resource_group_name: str, 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", "2026-03-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/hardwareSettings" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_hardware_settings_get_request( + resource_group_name: str, name: str, hardware_setting_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", "2026-03-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/hardwareSettings/{hardwareSettingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + "hardwareSettingName": _SERIALIZER.url("hardware_setting_name", hardware_setting_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_hardware_settings_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, name: str, hardware_setting_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/hardwareSettings/{hardwareSettingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + "hardwareSettingName": _SERIALIZER.url("hardware_setting_name", hardware_setting_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_hardware_settings_delete_request( + resource_group_name: str, name: str, hardware_setting_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-15")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Edge/disconnectedOperations/{name}/hardwareSettings/{hardwareSettingName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + "hardwareSettingName": _SERIALIZER.url("hardware_setting_name", hardware_setting_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + class DisconnectedOperationsOperations: """ .. warning:: @@ -498,7 +611,10 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Dis except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -567,7 +683,10 @@ def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -902,7 +1021,10 @@ def update( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -955,7 +1077,10 @@ def _delete_initial(self, resource_group_name: str, name: str, **kwargs: Any) -> except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1111,7 +1236,10 @@ 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) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1196,7 +1324,10 @@ 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) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1259,7 +1390,10 @@ def list_deployment_manifest( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1394,7 +1528,10 @@ 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) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1457,7 +1594,10 @@ def get(self, resource_group_name: str, name: str, image_name: str, **kwargs: An except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1528,7 +1668,10 @@ def list_download_uri( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1650,7 +1793,10 @@ 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) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1718,7 +1864,10 @@ def get( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1792,7 +1941,10 @@ def list_download_uri( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _failsafe_deserialize(_models.ErrorResponse, response) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1804,3 +1956,633 @@ def list_download_uri( return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + + +class HardwareSettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.disconnectedoperations.DisconnectedOperationsMgmtClient`'s + :attr:`hardware_settings` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DisconnectedOperationsMgmtClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-15", + params_added_on={"2026-03-15": ["api_version", "subscription_id", "resource_group_name", "name", "accept"]}, + api_versions_list=["2026-03-15"], + ) + def list_by_parent( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> ItemPaged["_models.HardwareSetting"]: + """List by parent. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: Name of the resource. Required. + :type name: str + :return: An iterator like instance of HardwareSetting + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.disconnectedoperations.models.HardwareSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[list[_models.HardwareSetting]] = 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_hardware_settings_list_by_parent_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(list[_models.HardwareSetting], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-15", + params_added_on={ + "2026-03-15": [ + "api_version", + "subscription_id", + "resource_group_name", + "name", + "hardware_setting_name", + "accept", + ] + }, + api_versions_list=["2026-03-15"], + ) + def get( + self, resource_group_name: str, name: str, hardware_setting_name: str, **kwargs: Any + ) -> _models.HardwareSetting: + """Get the hardware settings resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: Name of the resource. Required. + :type name: str + :param hardware_setting_name: The name of the HardwareSetting. Required. + :type hardware_setting_name: str + :return: HardwareSetting. The HardwareSetting is compatible with MutableMapping + :rtype: ~azure.mgmt.disconnectedoperations.models.HardwareSetting + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.HardwareSetting] = kwargs.pop("cls", None) + + _request = build_hardware_settings_get_request( + resource_group_name=resource_group_name, + name=name, + hardware_setting_name=hardware_setting_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.HardwareSetting, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @api_version_validation( + method_added_on="2026-03-15", + params_added_on={ + "2026-03-15": [ + "api_version", + "subscription_id", + "resource_group_name", + "name", + "hardware_setting_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15"], + ) + def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + hardware_setting_name: str, + resource: Union[_models.HardwareSetting, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_hardware_settings_create_or_update_request( + resource_group_name=resource_group_name, + name=name, + hardware_setting_name=hardware_setting_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + name: str, + hardware_setting_name: str, + resource: _models.HardwareSetting, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.HardwareSetting]: + """Create or update hardware settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: Name of the resource. Required. + :type name: str + :param hardware_setting_name: The name of the HardwareSetting. Required. + :type hardware_setting_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.disconnectedoperations.models.HardwareSetting + :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 HardwareSetting. The HardwareSetting is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.disconnectedoperations.models.HardwareSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + name: str, + hardware_setting_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.HardwareSetting]: + """Create or update hardware settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: Name of the resource. Required. + :type name: str + :param hardware_setting_name: The name of the HardwareSetting. Required. + :type hardware_setting_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns HardwareSetting. The HardwareSetting is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.disconnectedoperations.models.HardwareSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + name: str, + hardware_setting_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.HardwareSetting]: + """Create or update hardware settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: Name of the resource. Required. + :type name: str + :param hardware_setting_name: The name of the HardwareSetting. Required. + :type hardware_setting_name: str + :param resource: Resource create parameters. Required. + :type resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns HardwareSetting. The HardwareSetting is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.disconnectedoperations.models.HardwareSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-15", + params_added_on={ + "2026-03-15": [ + "api_version", + "subscription_id", + "resource_group_name", + "name", + "hardware_setting_name", + "content_type", + "accept", + ] + }, + api_versions_list=["2026-03-15"], + ) + def begin_create_or_update( + self, + resource_group_name: str, + name: str, + hardware_setting_name: str, + resource: Union[_models.HardwareSetting, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.HardwareSetting]: + """Create or update hardware settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: Name of the resource. Required. + :type name: str + :param hardware_setting_name: The name of the HardwareSetting. Required. + :type hardware_setting_name: str + :param resource: Resource create parameters. Is one of the following types: HardwareSetting, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.disconnectedoperations.models.HardwareSetting or JSON or IO[bytes] + :return: An instance of LROPoller that returns HardwareSetting. The HardwareSetting is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.disconnectedoperations.models.HardwareSetting] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.HardwareSetting] = 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, + name=name, + hardware_setting_name=hardware_setting_name, + resource=resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.HardwareSetting, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.HardwareSetting].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.HardwareSetting]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @api_version_validation( + method_added_on="2026-03-15", + params_added_on={ + "2026-03-15": ["api_version", "subscription_id", "resource_group_name", "name", "hardware_setting_name"] + }, + api_versions_list=["2026-03-15"], + ) + def _delete_initial( + self, resource_group_name: str, name: str, hardware_setting_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_hardware_settings_delete_request( + resource_group_name=resource_group_name, + name=name, + hardware_setting_name=hardware_setting_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-15", + params_added_on={ + "2026-03-15": ["api_version", "subscription_id", "resource_group_name", "name", "hardware_setting_name"] + }, + api_versions_list=["2026-03-15"], + ) + def begin_delete( + self, resource_group_name: str, name: str, hardware_setting_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete hardware settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: Name of the resource. Required. + :type name: str + :param hardware_setting_name: The name of the HardwareSetting. Required. + :type hardware_setting_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + name=name, + hardware_setting_name=hardware_setting_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/artifact_list_by_parent_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/artifact_list_by_parent_maximum_set_gen.py index e77a18f6177b..40098ebe310a 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/artifact_list_by_parent_maximum_set_gen.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/artifact_list_by_parent_maximum_set_gen.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: 2025-06-01-preview/Artifact_ListByParent_MaximumSet_Gen.json +# x-ms-original-file: 2026-03-15/Artifact_ListByParent_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/artifact_list_download_uri_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/artifact_list_download_uri_maximum_set_gen.py index c4ef7b70dcef..5d9bed01c290 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/artifact_list_download_uri_maximum_set_gen.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/artifact_list_download_uri_maximum_set_gen.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: 2025-06-01-preview/Artifact_ListDownloadUri_MaximumSet_Gen.json +# x-ms-original-file: 2026-03-15/Artifact_ListDownloadUri_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/artifacts_get_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/artifacts_get_maximum_set_gen.py index 297ea0b68670..6e714c51e845 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/artifacts_get_maximum_set_gen.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/artifacts_get_maximum_set_gen.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: 2025-06-01-preview/Artifacts_Get_MaximumSet_Gen.json +# x-ms-original-file: 2026-03-15/Artifacts_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_create_or_update_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_create_or_update_maximum_set_gen.py index af0ae60b80d2..a9b109386e3b 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_create_or_update_maximum_set_gen.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_create_or_update_maximum_set_gen.py @@ -35,13 +35,22 @@ def main(): name="demo-resource", resource={ "location": "eastus", - "properties": {"billingModel": "Capacity", "connectionIntent": "Disconnected"}, + "properties": { + "benefitPlans": {"azureHybridWindowsServerBenefit": "Enabled", "windowsServerVmCount": 5}, + "billingConfiguration": { + "autoRenew": "Enabled", + "billingStatus": "Enabled", + "current": {"cores": 12, "pricingModel": "Trial"}, + }, + "billingModel": "Capacity", + "connectionIntent": "Disconnected", + }, "tags": {"key1": "value1"}, }, ).result() print(response) -# x-ms-original-file: 2025-06-01-preview/DisconnectedOperations_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: 2026-03-15/DisconnectedOperations_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_delete_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_delete_maximum_set_gen.py index 4db1455a8ee1..c8e98615e839 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_delete_maximum_set_gen.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_delete_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: 2025-06-01-preview/DisconnectedOperations_Delete_MaximumSet_Gen.json +# x-ms-original-file: 2026-03-15/DisconnectedOperations_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_get_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_get_maximum_set_gen.py index a0d2928730fe..5ec93a961eaf 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_get_maximum_set_gen.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_get_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2025-06-01-preview/DisconnectedOperations_Get_MaximumSet_Gen.json +# x-ms-original-file: 2026-03-15/DisconnectedOperations_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_list_by_resource_group_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_list_by_resource_group_maximum_set_gen.py new file mode 100644 index 000000000000..d828ea805663 --- /dev/null +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_list_by_resource_group_maximum_set_gen.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.disconnectedoperations import DisconnectedOperationsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-disconnectedoperations +# USAGE + python disconnected_operations_list_by_resource_group_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DisconnectedOperationsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.disconnected_operations.list_by_resource_group( + resource_group_name="rgdisconnectedoperations", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-03-15/DisconnectedOperations_ListByResourceGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_list_by_subscription_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_list_by_subscription_maximum_set_gen.py new file mode 100644 index 000000000000..eae495c3205b --- /dev/null +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_list_by_subscription_maximum_set_gen.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.disconnectedoperations import DisconnectedOperationsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-disconnectedoperations +# USAGE + python disconnected_operations_list_by_subscription_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DisconnectedOperationsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.disconnected_operations.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: 2026-03-15/DisconnectedOperations_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_list_deployment_manifest_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_list_deployment_manifest_maximum_set_gen.py index 89ecc219c8fb..da61dfb1330c 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_list_deployment_manifest_maximum_set_gen.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_list_deployment_manifest_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2025-06-01-preview/DisconnectedOperations_ListDeploymentManifest_MaximumSet_Gen.json +# x-ms-original-file: 2026-03-15/DisconnectedOperations_ListDeploymentManifest_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_update_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_update_maximum_set_gen.py new file mode 100644 index 000000000000..a1a310120f37 --- /dev/null +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/disconnected_operations_update_maximum_set_gen.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.disconnectedoperations import DisconnectedOperationsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-disconnectedoperations +# USAGE + python disconnected_operations_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DisconnectedOperationsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.disconnected_operations.update( + resource_group_name="rgdisconnectedoperations", + name="demo-resource", + properties={ + "properties": { + "connectionIntent": "Connected", + "deviceVersion": "2.0.0", + "registrationStatus": "Registered", + }, + "tags": {"key2": "value2"}, + }, + ) + print(response) + + +# x-ms-original-file: 2026-03-15/DisconnectedOperations_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/hardware_settings_create_or_update_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/hardware_settings_create_or_update_maximum_set_gen.py new file mode 100644 index 000000000000..efa94220eaf1 --- /dev/null +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/hardware_settings_create_or_update_maximum_set_gen.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.disconnectedoperations import DisconnectedOperationsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-disconnectedoperations +# USAGE + python hardware_settings_create_or_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DisconnectedOperationsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.hardware_settings.begin_create_or_update( + resource_group_name="rgdisconnectedOperations", + name="demo-resource", + hardware_setting_name="default", + resource={ + "properties": { + "deviceId": "663ee8a3-4ea8-48ec-8810-b1f8b86cb270", + "diskSpaceInGb": 1024, + "hardwareSku": "MC-760", + "memoryInGb": 64, + "nodes": 3, + "oem": "Contoso", + "solutionBuilderExtension": "xyz", + "totalCores": 200, + "versionAtRegistration": "2411.2", + } + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-03-15/HardwareSettings_CreateOrUpdate_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/hardware_settings_delete_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/hardware_settings_delete_maximum_set_gen.py new file mode 100644 index 000000000000..6ad7696e025a --- /dev/null +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/hardware_settings_delete_maximum_set_gen.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.disconnectedoperations import DisconnectedOperationsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-disconnectedoperations +# USAGE + python hardware_settings_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DisconnectedOperationsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.hardware_settings.begin_delete( + resource_group_name="rgdisconnectedOperations", + name="demo-resource", + hardware_setting_name="default", + ).result() + + +# x-ms-original-file: 2026-03-15/HardwareSettings_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/hardware_settings_get_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/hardware_settings_get_maximum_set_gen.py new file mode 100644 index 000000000000..e258812972bb --- /dev/null +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/hardware_settings_get_maximum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.disconnectedoperations import DisconnectedOperationsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-disconnectedoperations +# USAGE + python hardware_settings_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DisconnectedOperationsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.hardware_settings.get( + resource_group_name="rgdisconnectedOperations", + name="demo-resource", + hardware_setting_name="default", + ) + print(response) + + +# x-ms-original-file: 2026-03-15/HardwareSettings_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/hardware_settings_list_by_parent_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/hardware_settings_list_by_parent_maximum_set_gen.py new file mode 100644 index 000000000000..a39d20e58059 --- /dev/null +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/hardware_settings_list_by_parent_maximum_set_gen.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.disconnectedoperations import DisconnectedOperationsMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-disconnectedoperations +# USAGE + python hardware_settings_list_by_parent_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DisconnectedOperationsMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.hardware_settings.list_by_parent( + resource_group_name="rgdisconnectedOperations", + name="demo-resource", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2026-03-15/HardwareSettings_ListByParent_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/images_get_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/images_get_maximum_set_gen.py index 2ce2eb52b9fd..19f71d83237d 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/images_get_maximum_set_gen.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/images_get_maximum_set_gen.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2025-06-01-preview/Images_Get_MaximumSet_Gen.json +# x-ms-original-file: 2026-03-15/Images_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/images_list_by_disconnected_operation_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/images_list_by_disconnected_operation_maximum_set_gen.py index c20a9fed0cbc..d4fb44a2ba46 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/images_list_by_disconnected_operation_maximum_set_gen.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/images_list_by_disconnected_operation_maximum_set_gen.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2025-06-01-preview/Images_ListByDisconnectedOperation_MaximumSet_Gen.json +# x-ms-original-file: 2026-03-15/Images_ListByDisconnectedOperation_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/images_list_download_uri_maximum_set_gen.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/images_list_download_uri_maximum_set_gen.py index 23b91f7a1f71..12f5b0b6cf57 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/images_list_download_uri_maximum_set_gen.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_samples/images_list_download_uri_maximum_set_gen.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: 2025-06-01-preview/Images_ListDownloadUri_MaximumSet_Gen.json +# x-ms-original-file: 2026-03-15/Images_ListDownloadUri_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_tests/test_disconnected_operations_mgmt_disconnected_operations_operations.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_tests/test_disconnected_operations_mgmt_disconnected_operations_operations.py index e55e08179c15..5ab8737d4455 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_tests/test_disconnected_operations_mgmt_disconnected_operations_operations.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_tests/test_disconnected_operations_mgmt_disconnected_operations_operations.py @@ -43,6 +43,23 @@ def test_disconnected_operations_begin_create_or_update(self, resource_group): "billingModel": "str", "connectionIntent": "str", "stampId": "str", + "benefitPlans": {"azureHybridWindowsServerBenefit": "str", "windowsServerVmCount": 0}, + "billingConfiguration": { + "autoRenew": "str", + "billingStatus": "str", + "current": { + "cores": 0, + "pricingModel": "str", + "endDate": "2020-02-20", + "startDate": "2020-02-20", + }, + "upcoming": { + "cores": 0, + "pricingModel": "str", + "endDate": "2020-02-20", + "startDate": "2020-02-20", + }, + }, "connectionStatus": "str", "deviceVersion": "str", "provisioningState": "str", @@ -71,7 +88,28 @@ def test_disconnected_operations_update(self, resource_group): resource_group_name=resource_group.name, name="str", properties={ - "properties": {"connectionIntent": "str", "deviceVersion": "str", "registrationStatus": "str"}, + "properties": { + "benefitPlans": {"azureHybridWindowsServerBenefit": "str", "windowsServerVmCount": 0}, + "billingConfiguration": { + "autoRenew": "str", + "billingStatus": "str", + "current": { + "cores": 0, + "pricingModel": "str", + "endDate": "2020-02-20", + "startDate": "2020-02-20", + }, + "upcoming": { + "cores": 0, + "pricingModel": "str", + "endDate": "2020-02-20", + "startDate": "2020-02-20", + }, + }, + "connectionIntent": "str", + "deviceVersion": "str", + "registrationStatus": "str", + }, "tags": {"str": "str"}, }, ) diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_tests/test_disconnected_operations_mgmt_disconnected_operations_operations_async.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_tests/test_disconnected_operations_mgmt_disconnected_operations_operations_async.py index 3c8c6f6b0bcb..36467ae62f24 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_tests/test_disconnected_operations_mgmt_disconnected_operations_operations_async.py +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_tests/test_disconnected_operations_mgmt_disconnected_operations_operations_async.py @@ -45,6 +45,23 @@ async def test_disconnected_operations_begin_create_or_update(self, resource_gro "billingModel": "str", "connectionIntent": "str", "stampId": "str", + "benefitPlans": {"azureHybridWindowsServerBenefit": "str", "windowsServerVmCount": 0}, + "billingConfiguration": { + "autoRenew": "str", + "billingStatus": "str", + "current": { + "cores": 0, + "pricingModel": "str", + "endDate": "2020-02-20", + "startDate": "2020-02-20", + }, + "upcoming": { + "cores": 0, + "pricingModel": "str", + "endDate": "2020-02-20", + "startDate": "2020-02-20", + }, + }, "connectionStatus": "str", "deviceVersion": "str", "provisioningState": "str", @@ -74,7 +91,28 @@ async def test_disconnected_operations_update(self, resource_group): resource_group_name=resource_group.name, name="str", properties={ - "properties": {"connectionIntent": "str", "deviceVersion": "str", "registrationStatus": "str"}, + "properties": { + "benefitPlans": {"azureHybridWindowsServerBenefit": "str", "windowsServerVmCount": 0}, + "billingConfiguration": { + "autoRenew": "str", + "billingStatus": "str", + "current": { + "cores": 0, + "pricingModel": "str", + "endDate": "2020-02-20", + "startDate": "2020-02-20", + }, + "upcoming": { + "cores": 0, + "pricingModel": "str", + "endDate": "2020-02-20", + "startDate": "2020-02-20", + }, + }, + "connectionIntent": "str", + "deviceVersion": "str", + "registrationStatus": "str", + }, "tags": {"str": "str"}, }, ) diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_tests/test_disconnected_operations_mgmt_hardware_settings_operations.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_tests/test_disconnected_operations_mgmt_hardware_settings_operations.py new file mode 100644 index 000000000000..f73047d49cb5 --- /dev/null +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_tests/test_disconnected_operations_mgmt_hardware_settings_operations.py @@ -0,0 +1,91 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.disconnectedoperations import DisconnectedOperationsMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDisconnectedOperationsMgmtHardwareSettingsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DisconnectedOperationsMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_hardware_settings_list_by_parent(self, resource_group): + response = self.client.hardware_settings.list_by_parent( + resource_group_name=resource_group.name, + name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_hardware_settings_get(self, resource_group): + response = self.client.hardware_settings.get( + resource_group_name=resource_group.name, + name="str", + hardware_setting_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_hardware_settings_begin_create_or_update(self, resource_group): + response = self.client.hardware_settings.begin_create_or_update( + resource_group_name=resource_group.name, + name="str", + hardware_setting_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "deviceId": "str", + "diskSpaceInGb": 0, + "hardwareSku": "str", + "memoryInGb": 0, + "nodes": 0, + "oem": "str", + "solutionBuilderExtension": "str", + "totalCores": 0, + "versionAtRegistration": "str", + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_hardware_settings_begin_delete(self, resource_group): + response = self.client.hardware_settings.begin_delete( + resource_group_name=resource_group.name, + name="str", + hardware_setting_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_tests/test_disconnected_operations_mgmt_hardware_settings_operations_async.py b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_tests/test_disconnected_operations_mgmt_hardware_settings_operations_async.py new file mode 100644 index 000000000000..8aaa458bca37 --- /dev/null +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/generated_tests/test_disconnected_operations_mgmt_hardware_settings_operations_async.py @@ -0,0 +1,96 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.disconnectedoperations.aio import DisconnectedOperationsMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDisconnectedOperationsMgmtHardwareSettingsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DisconnectedOperationsMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_hardware_settings_list_by_parent(self, resource_group): + response = self.client.hardware_settings.list_by_parent( + resource_group_name=resource_group.name, + name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_hardware_settings_get(self, resource_group): + response = await self.client.hardware_settings.get( + resource_group_name=resource_group.name, + name="str", + hardware_setting_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_hardware_settings_begin_create_or_update(self, resource_group): + response = await ( + await self.client.hardware_settings.begin_create_or_update( + resource_group_name=resource_group.name, + name="str", + hardware_setting_name="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "deviceId": "str", + "diskSpaceInGb": 0, + "hardwareSku": "str", + "memoryInGb": 0, + "nodes": 0, + "oem": "str", + "solutionBuilderExtension": "str", + "totalCores": 0, + "versionAtRegistration": "str", + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_hardware_settings_begin_delete(self, resource_group): + response = await ( + await self.client.hardware_settings.begin_delete( + resource_group_name=resource_group.name, + name="str", + hardware_setting_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/pyproject.toml b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/pyproject.toml index b8f9da5b9369..6e03f9ac5625 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/pyproject.toml +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/pyproject.toml @@ -13,7 +13,7 @@ authors = [ description = "Microsoft Azure Disconnectedoperations Management Client Library for Python" license = "MIT" classifiers = [ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", @@ -54,8 +54,8 @@ content-type = "text/markdown" [tool.setuptools.packages.find] exclude = [ "tests*", - "samples*", "generated_tests*", + "samples*", "generated_samples*", "doc*", "azure", @@ -77,7 +77,7 @@ package_name = "azure-mgmt-disconnectedoperations" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Disconnectedoperations Management" package_doc_id = "" -is_stable = false +is_stable = true is_arm = true need_msrestazure = false need_azuremgmtcore = true diff --git a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/tsp-location.yaml b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/tsp-location.yaml index 485ec225d716..3725ee3af4a7 100644 --- a/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/tsp-location.yaml +++ b/sdk/disconnectedoperations/azure-mgmt-disconnectedoperations/tsp-location.yaml @@ -1,5 +1,5 @@ directory: specification/edge/Microsoft.Edge.DisconnectedOperations.Management -commit: 23e8495fba7c3a1ef9ac40cc6317ac29db76130d +commit: 13527a197ab5b1366442ab8306608e44ae923e95 repo: Azure/azure-rest-api-specs additionalDirectories: - specification/edge/Microsoft.Edge.Shared