diff --git a/sdk/fabric/azure-mgmt-fabric/CHANGELOG.md b/sdk/fabric/azure-mgmt-fabric/CHANGELOG.md index 88133de54311..4b66164c4a70 100644 --- a/sdk/fabric/azure-mgmt-fabric/CHANGELOG.md +++ b/sdk/fabric/azure-mgmt-fabric/CHANGELOG.md @@ -1,5 +1,18 @@ # Release History +## 1.1.0b1 (2025-05-13) + +### Features Added + + - Added model `Quota` + - Added model `QuotaName` + - Model `FabricCapacitiesOperations` added method `list_usages` + - Method `Operation.__init__` has a new overload `def __init__(self: None, display: Optional[_models.OperationDisplay])` + - Method `Quota.__init__` has a new overload `def __init__(self: None, unit: str, current_value: int, limit: int)` + - Method `Quota.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `QuotaName.__init__` has a new overload `def __init__(self: None, value: Optional[str], localized_value: Optional[str])` + - Method `QuotaName.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + ## 1.0.0 (2024-10-21) ### Other Changes diff --git a/sdk/fabric/azure-mgmt-fabric/README.md b/sdk/fabric/azure-mgmt-fabric/README.md index 61b8c45bb533..c9aaca21b874 100644 --- a/sdk/fabric/azure-mgmt-fabric/README.md +++ b/sdk/fabric/azure-mgmt-fabric/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Fabric Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/fabric/azure-mgmt-fabric/_meta.json b/sdk/fabric/azure-mgmt-fabric/_meta.json index 9823b57d01c5..e7cfe8b32fc7 100644 --- a/sdk/fabric/azure-mgmt-fabric/_meta.json +++ b/sdk/fabric/azure-mgmt-fabric/_meta.json @@ -1,6 +1,6 @@ { - "commit": "9ce76c4f113368361dac4de5d0a71eb058602756", + "commit": "b9a8c9e8eb8998a222f126a005d1ab633f1daad9", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/fabric/Microsoft.Fabric.Management", - "@azure-tools/typespec-python": "0.36.0" + "@azure-tools/typespec-python": "0.44.2" } \ No newline at end of file diff --git a/sdk/fabric/azure-mgmt-fabric/apiview-properties.json b/sdk/fabric/azure-mgmt-fabric/apiview-properties.json new file mode 100644 index 000000000000..42ddbde34fa1 --- /dev/null +++ b/sdk/fabric/azure-mgmt-fabric/apiview-properties.json @@ -0,0 +1,58 @@ +{ + "CrossLanguagePackageId": "Microsoft.Fabric", + "CrossLanguageDefinitionId": { + "azure.mgmt.fabric.models.CapacityAdministration": "Microsoft.Fabric.CapacityAdministration", + "azure.mgmt.fabric.models.CheckNameAvailabilityRequest": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityRequest", + "azure.mgmt.fabric.models.CheckNameAvailabilityResponse": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityResponse", + "azure.mgmt.fabric.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.fabric.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.fabric.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.fabric.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.fabric.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.fabric.models.FabricCapacity": "Microsoft.Fabric.FabricCapacity", + "azure.mgmt.fabric.models.FabricCapacityProperties": "Microsoft.Fabric.FabricCapacityProperties", + "azure.mgmt.fabric.models.FabricCapacityUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", + "azure.mgmt.fabric.models.FabricCapacityUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.fabric.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.fabric.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.fabric.models.Quota": "Microsoft.Fabric.Quota", + "azure.mgmt.fabric.models.QuotaName": "Microsoft.Fabric.QuotaName", + "azure.mgmt.fabric.models.RpSku": "Microsoft.Fabric.RpSku", + "azure.mgmt.fabric.models.RpSkuDetailsForExistingResource": "Microsoft.Fabric.RpSkuDetailsForExistingResource", + "azure.mgmt.fabric.models.RpSkuDetailsForNewResource": "Microsoft.Fabric.RpSkuDetailsForNewResource", + "azure.mgmt.fabric.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.fabric.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.fabric.models.ProvisioningState": "Microsoft.Fabric.ProvisioningState", + "azure.mgmt.fabric.models.ResourceState": "Microsoft.Fabric.ResourceState", + "azure.mgmt.fabric.models.RpSkuTier": "Microsoft.Fabric.RpSkuTier", + "azure.mgmt.fabric.models.CheckNameAvailabilityReason": "Azure.ResourceManager.CommonTypes.CheckNameAvailabilityReason", + "azure.mgmt.fabric.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.fabric.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.fabric.operations.FabricCapacitiesOperations.get": "Microsoft.Fabric.FabricCapacities.get", + "azure.mgmt.fabric.aio.operations.FabricCapacitiesOperations.get": "Microsoft.Fabric.FabricCapacities.get", + "azure.mgmt.fabric.operations.FabricCapacitiesOperations.begin_create_or_update": "Microsoft.Fabric.FabricCapacities.createOrUpdate", + "azure.mgmt.fabric.aio.operations.FabricCapacitiesOperations.begin_create_or_update": "Microsoft.Fabric.FabricCapacities.createOrUpdate", + "azure.mgmt.fabric.operations.FabricCapacitiesOperations.begin_update": "Microsoft.Fabric.FabricCapacities.update", + "azure.mgmt.fabric.aio.operations.FabricCapacitiesOperations.begin_update": "Microsoft.Fabric.FabricCapacities.update", + "azure.mgmt.fabric.operations.FabricCapacitiesOperations.begin_delete": "Microsoft.Fabric.FabricCapacities.delete", + "azure.mgmt.fabric.aio.operations.FabricCapacitiesOperations.begin_delete": "Microsoft.Fabric.FabricCapacities.delete", + "azure.mgmt.fabric.operations.FabricCapacitiesOperations.list_by_resource_group": "Microsoft.Fabric.FabricCapacities.listByResourceGroup", + "azure.mgmt.fabric.aio.operations.FabricCapacitiesOperations.list_by_resource_group": "Microsoft.Fabric.FabricCapacities.listByResourceGroup", + "azure.mgmt.fabric.operations.FabricCapacitiesOperations.list_by_subscription": "Microsoft.Fabric.FabricCapacities.listBySubscription", + "azure.mgmt.fabric.aio.operations.FabricCapacitiesOperations.list_by_subscription": "Microsoft.Fabric.FabricCapacities.listBySubscription", + "azure.mgmt.fabric.operations.FabricCapacitiesOperations.begin_resume": "Microsoft.Fabric.FabricCapacities.resume", + "azure.mgmt.fabric.aio.operations.FabricCapacitiesOperations.begin_resume": "Microsoft.Fabric.FabricCapacities.resume", + "azure.mgmt.fabric.operations.FabricCapacitiesOperations.begin_suspend": "Microsoft.Fabric.FabricCapacities.suspend", + "azure.mgmt.fabric.aio.operations.FabricCapacitiesOperations.begin_suspend": "Microsoft.Fabric.FabricCapacities.suspend", + "azure.mgmt.fabric.operations.FabricCapacitiesOperations.check_name_availability": "Microsoft.Fabric.FabricCapacities.checkNameAvailability", + "azure.mgmt.fabric.aio.operations.FabricCapacitiesOperations.check_name_availability": "Microsoft.Fabric.FabricCapacities.checkNameAvailability", + "azure.mgmt.fabric.operations.FabricCapacitiesOperations.list_skus_for_capacity": "Microsoft.Fabric.FabricCapacities.listSkusForCapacity", + "azure.mgmt.fabric.aio.operations.FabricCapacitiesOperations.list_skus_for_capacity": "Microsoft.Fabric.FabricCapacities.listSkusForCapacity", + "azure.mgmt.fabric.operations.FabricCapacitiesOperations.list_skus": "Microsoft.Fabric.FabricCapacities.listSkus", + "azure.mgmt.fabric.aio.operations.FabricCapacitiesOperations.list_skus": "Microsoft.Fabric.FabricCapacities.listSkus", + "azure.mgmt.fabric.operations.FabricCapacitiesOperations.list_usages": "Microsoft.Fabric.FabricCapacities.listUsages", + "azure.mgmt.fabric.aio.operations.FabricCapacitiesOperations.list_usages": "Microsoft.Fabric.FabricCapacities.listUsages", + "azure.mgmt.fabric.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.fabric.aio.operations.Operations.list": "Azure.ResourceManager.Operations.list" + } +} \ No newline at end of file diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/__init__.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/__init__.py index 302b37eefa01..5921df3dd515 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/__init__.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._client import FabricMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import FabricMgmtClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_client.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_client.py index 7082b98c2462..bf785f2f7b55 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_client.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_client.py @@ -7,16 +7,18 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from ._configuration import FabricMgmtClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer from .operations import FabricCapacitiesOperations, Operations if TYPE_CHECKING: @@ -34,26 +36,33 @@ class FabricMgmtClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service host. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is "2023-11-01". - Note that overriding this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is + "2025-01-15-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: _endpoint = "{endpoint}" + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = FabricMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + credential_scopes=credential_scopes, + **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -72,7 +81,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs) self._serialize = Serializer() self._deserialize = Deserializer() diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_configuration.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_configuration.py index e6c0c711d9ab..3eb9540eb6e2 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_configuration.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_configuration.py @@ -29,8 +29,9 @@ class FabricMgmtClientConfiguration: # pylint: disable=too-many-instance-attrib :type subscription_id: str :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is "2023-11-01". - Note that overriding this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is + "2025-01-15-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ @@ -41,7 +42,7 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2023-11-01") + api_version: str = kwargs.pop("api_version", "2025-01-15-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_patch.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_patch.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_utils/__init__.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_utils/__init__.py new file mode 100644 index 000000000000..8026245c2abc --- /dev/null +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_model_base.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_utils/model_base.py similarity index 92% rename from sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_model_base.py rename to sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_utils/model_base.py index 9d401b0cf012..49d5c7259389 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_model_base.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_utils/model_base.py @@ -2,10 +2,11 @@ # 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. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except, too-many-lines +# pylint: disable=protected-access, broad-except import copy import calendar @@ -21,6 +22,7 @@ from datetime import datetime, date, time, timedelta, timezone from json import JSONEncoder import xml.etree.ElementTree as ET +from collections.abc import MutableMapping from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError @@ -28,11 +30,6 @@ from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping - _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -347,7 +344,7 @@ def _get_model(module_name: str, model_name: str): _UNSET = object() -class _MyMutableMapping(MutableMapping[str, typing.Any]): # pylint: disable=unsubscriptable-object +class _MyMutableMapping(MutableMapping[str, typing.Any]): def __init__(self, data: typing.Dict[str, typing.Any]) -> None: self._data = data @@ -373,50 +370,97 @@ def __ne__(self, other: typing.Any) -> bool: return not self.__eq__(other) def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ return self._data.keys() def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ return self._data.values() def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ return self._data.items() def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ try: return self[key] except KeyError: return default @typing.overload - def pop(self, key: str) -> typing.Any: ... + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ @typing.overload - def pop(self, key: str, default: _T) -> _T: ... + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs @typing.overload - def pop(self, key: str, default: typing.Any) -> typing.Any: ... + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ if default is _UNSET: return self._data.pop(key) return self._data.pop(key, default) def popitem(self) -> typing.Tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ return self._data.popitem() def clear(self) -> None: + """ + Remove all items from D. + """ self._data.clear() - def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ self._data.update(*args, **kwargs) @typing.overload def setdefault(self, key: str, default: None = None) -> None: ... @typing.overload - def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ if default is _UNSET: return self._data.setdefault(key) return self._data.setdefault(key, default) @@ -574,7 +618,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: def copy(self) -> "Model": return Model(self.__dict__) - def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: disable=unused-argument + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' @@ -585,8 +629,8 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: di annotations = { k: v for mro_class in mros - if hasattr(mro_class, "__annotations__") # pylint: disable=no-member - for k, v in mro_class.__annotations__.items() # pylint: disable=no-member + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() } for attr, rf in attr_to_rest_field.items(): rf._module = cls.__module__ @@ -597,12 +641,12 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: di cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - return super().__new__(cls) # pylint: disable=no-value-for-parameter + return super().__new__(cls) def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: for base in cls.__bases__: - if hasattr(base, "__mapping__"): # pylint: disable=no-member - base.__mapping__[discriminator or cls.__name__] = cls # type: ignore # pylint: disable=no-member + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore @classmethod def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: @@ -613,7 +657,7 @@ def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField @classmethod def _deserialize(cls, data, exist_discriminators): - if not hasattr(cls, "__mapping__"): # pylint: disable=no-member + if not hasattr(cls, "__mapping__"): return cls(data) discriminator = cls._get_discriminator(exist_discriminators) if discriminator is None: @@ -754,7 +798,7 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur except AttributeError: model_name = annotation if module is not None: - annotation = _get_model(module, model_name) + annotation = _get_model(module, model_name) # type: ignore try: if module and _is_model(annotation): @@ -894,6 +938,35 @@ def _deserialize( return _deserialize_with_callable(deserializer, value) +def _failsafe_deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, value, module, rf, format) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + value: typing.Any, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, value) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + class _RestField: def __init__( self, diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_serialization.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_utils/serialization.py similarity index 93% rename from sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_serialization.py rename to sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_utils/serialization.py index 480e941d758f..eb86ea23c965 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_serialization.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_utils/serialization.py @@ -1,27 +1,10 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# 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. # -------------------------------------------------------------------------- # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -47,9 +30,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -60,13 +41,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -184,73 +165,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -478,8 +393,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -506,7 +421,6 @@ def _flatten_subtype(cls, key, objects): def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. :param dict response: The initial data :param dict objects: The class objects @@ -518,7 +432,7 @@ def _classify(cls, response, objects): if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -563,7 +477,7 @@ def _decode_attribute_map_key(key): return key.replace("\\.", ".") -class Serializer(object): # pylint: disable=too-many-public-methods +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -626,7 +540,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -736,8 +650,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -781,8 +695,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -805,8 +719,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -835,8 +749,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -855,9 +769,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1192,7 +1106,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1218,7 +1132,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1251,7 +1165,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1429,7 +1343,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1441,7 +1355,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1488,7 +1402,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1502,7 +1416,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1683,17 +1597,21 @@ def _instantiate_model(self, response, attrs, additional_properties=None): subtype = getattr(response, "_subtype_map", {}) try: readonly = [ - k for k, v in response._validation.items() if v.get("readonly") # pylint: disable=protected-access + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") ] const = [ - k for k, v in response._validation.items() if v.get("constant") # pylint: disable=protected-access + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore @@ -1713,7 +1631,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1795,7 +1713,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1841,7 +1759,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1932,7 +1850,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1945,7 +1863,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1960,7 +1878,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1978,7 +1896,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1991,7 +1909,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2009,7 +1927,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2025,7 +1943,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2040,14 +1958,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2063,7 +1981,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2101,7 +2019,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_version.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_version.py index 0ec13ea52bbf..a1f432eddc4e 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_version.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.1.0b1" diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/__init__.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/__init__.py index 7d2657c22057..fb290457d054 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/__init__.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._client import FabricMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import FabricMgmtClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/_client.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/_client.py index 065196888907..c69669ff2c31 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/_client.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/_client.py @@ -7,15 +7,17 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import FabricMgmtClientConfiguration from .operations import FabricCapacitiesOperations, Operations @@ -34,26 +36,33 @@ class FabricMgmtClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service host. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is "2023-11-01". - Note that overriding this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is + "2025-01-15-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: _endpoint = "{endpoint}" + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = FabricMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + credential_scopes=credential_scopes, + **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -72,7 +81,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, _endpoint), policies=_policies, **kwargs + ) self._serialize = Serializer() self._deserialize = Deserializer() diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/_configuration.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/_configuration.py index f6c07cb153f5..09f247b6b786 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/_configuration.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/_configuration.py @@ -29,8 +29,9 @@ class FabricMgmtClientConfiguration: # pylint: disable=too-many-instance-attrib :type subscription_id: str :param base_url: Service host. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: The API version to use for this operation. Default value is "2023-11-01". - Note that overriding this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is + "2025-01-15-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ @@ -41,7 +42,7 @@ def __init__( base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2023-11-01") + api_version: str = kwargs.pop("api_version", "2025-01-15-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/_patch.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/_patch.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/operations/__init__.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/operations/__init__.py index 29912dd9df22..5c4a04ad0951 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/operations/__init__.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/operations/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import FabricCapacitiesOperations -from ._operations import Operations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import FabricCapacitiesOperations # type: ignore +from ._operations import Operations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/operations/_operations.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/operations/_operations.py index 64b987343d8e..845501272f15 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/operations/_operations.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/operations/_operations.py @@ -6,12 +6,13 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase import json -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -33,7 +34,8 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._model_base import SdkJSONEncoder, _deserialize +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.serialization import Deserializer, Serializer from ...operations._operations import ( build_fabric_capacities_check_name_availability_request, build_fabric_capacities_create_or_update_request, @@ -43,17 +45,15 @@ build_fabric_capacities_list_by_subscription_request, build_fabric_capacities_list_skus_for_capacity_request, build_fabric_capacities_list_skus_request, + build_fabric_capacities_list_usages_request, build_fabric_capacities_resume_request, build_fabric_capacities_suspend_request, build_fabric_capacities_update_request, build_operations_list_request, ) +from .._configuration import FabricMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,10 +70,10 @@ class FabricCapacitiesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: FabricMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_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_async async def get(self, resource_group_name: str, capacity_name: str, **kwargs: Any) -> _models.FabricCapacity: @@ -129,7 +129,7 @@ async def get(self, resource_group_name: str, capacity_name: str, **kwargs: Any) except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -198,7 +198,7 @@ async def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -434,7 +434,7 @@ async def _update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -654,7 +654,7 @@ async def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -794,7 +794,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.FabricCapacity], deserialized["value"]) + list_of_elem = _deserialize(List[_models.FabricCapacity], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -810,7 +810,7 @@ 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 = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -878,7 +878,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.FabricCapacity], deserialized["value"]) + list_of_elem = _deserialize(List[_models.FabricCapacity], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -894,7 +894,7 @@ 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 = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -943,7 +943,7 @@ async def _resume_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1058,7 +1058,7 @@ async def _suspend_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1258,7 +1258,7 @@ async def check_name_availability( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1342,7 +1342,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.RpSkuDetailsForExistingResource], deserialized["value"]) + list_of_elem = _deserialize(List[_models.RpSkuDetailsForExistingResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1358,7 +1358,7 @@ 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 = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1427,7 +1427,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.RpSkuDetailsForNewResource], deserialized["value"]) + list_of_elem = _deserialize(List[_models.RpSkuDetailsForNewResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1443,7 +1443,94 @@ 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 = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_usages(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Quota"]: + """List the current consumption and limit in this location for the provided subscription. + + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of Quota + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.fabric.models.Quota] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Quota]] = 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_fabric_capacities_list_usages_request( + location=location, + 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.Quota], 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.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1463,10 +1550,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: FabricMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_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 def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -1528,7 +1615,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Operation], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1544,7 +1631,7 @@ 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 = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/operations/_patch.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/operations/_patch.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/aio/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/models/__init__.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/models/__init__.py index fe92b365a39f..2fed2f37b836 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/models/__init__.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/models/__init__.py @@ -5,35 +5,48 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models import CapacityAdministration -from ._models import CheckNameAvailabilityRequest -from ._models import CheckNameAvailabilityResponse -from ._models import ErrorAdditionalInfo -from ._models import ErrorDetail -from ._models import ErrorResponse -from ._models import FabricCapacity -from ._models import FabricCapacityProperties -from ._models import FabricCapacityUpdate -from ._models import FabricCapacityUpdateProperties -from ._models import Operation -from ._models import OperationDisplay -from ._models import Resource -from ._models import RpSku -from ._models import RpSkuDetailsForExistingResource -from ._models import RpSkuDetailsForNewResource -from ._models import SystemData -from ._models import TrackedResource +from typing import TYPE_CHECKING -from ._enums import ActionType -from ._enums import CheckNameAvailabilityReason -from ._enums import CreatedByType -from ._enums import Origin -from ._enums import ProvisioningState -from ._enums import ResourceState -from ._enums import RpSkuTier +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models import ( # type: ignore + CapacityAdministration, + CheckNameAvailabilityRequest, + CheckNameAvailabilityResponse, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + FabricCapacity, + FabricCapacityProperties, + FabricCapacityUpdate, + FabricCapacityUpdateProperties, + Operation, + OperationDisplay, + Quota, + QuotaName, + Resource, + RpSku, + RpSkuDetailsForExistingResource, + RpSkuDetailsForNewResource, + SystemData, + TrackedResource, +) + +from ._enums import ( # type: ignore + ActionType, + CheckNameAvailabilityReason, + CreatedByType, + Origin, + ProvisioningState, + ResourceState, + RpSkuTier, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -49,6 +62,8 @@ "FabricCapacityUpdateProperties", "Operation", "OperationDisplay", + "Quota", + "QuotaName", "Resource", "RpSku", "RpSkuDetailsForExistingResource", diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/models/_models.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/models/_models.py index 6f88e0bbf6c7..46df6e0d6ec4 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/models/_models.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/models/_models.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,26 +6,25 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation import datetime from typing import Any, Dict, List, Mapping, Optional, TYPE_CHECKING, Union, overload -from .. import _model_base -from .._model_base import rest_field +from .._utils.model_base import Model as _Model, rest_field if TYPE_CHECKING: from .. import models as _models -class CapacityAdministration(_model_base.Model): +class CapacityAdministration(_Model): """The administration properties of the Fabric capacity resource. - :ivar members: An array of administrator user identities. Required. :vartype members: list[str] """ - members: List[str] = rest_field() + members: List[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """An array of administrator user identities. Required.""" @overload @@ -41,11 +41,11 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CheckNameAvailabilityRequest(_model_base.Model): +class CheckNameAvailabilityRequest(_Model): """The check availability request body. :ivar name: The name of the resource for which availability needs to be checked. @@ -54,9 +54,9 @@ class CheckNameAvailabilityRequest(_model_base.Model): :vartype type: str """ - name: Optional[str] = rest_field() + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The name of the resource for which availability needs to be checked.""" - type: Optional[str] = rest_field() + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The resource type.""" @overload @@ -74,11 +74,11 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CheckNameAvailabilityResponse(_model_base.Model): +class CheckNameAvailabilityResponse(_Model): """The check availability result. :ivar name_available: Indicates if the resource name is available. @@ -90,12 +90,16 @@ class CheckNameAvailabilityResponse(_model_base.Model): :vartype message: str """ - name_available: Optional[bool] = rest_field(name="nameAvailable") + name_available: Optional[bool] = rest_field( + name="nameAvailable", visibility=["read", "create", "update", "delete", "query"] + ) """Indicates if the resource name is available.""" - reason: Optional[Union[str, "_models.CheckNameAvailabilityReason"]] = rest_field() + reason: Optional[Union[str, "_models.CheckNameAvailabilityReason"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The reason why the given name is not available. Known values are: \"Invalid\" and \"AlreadyExists\".""" - message: Optional[str] = rest_field() + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Detailed reason why the given name is not available.""" @overload @@ -114,15 +118,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ErrorAdditionalInfo(_model_base.Model): +class ErrorAdditionalInfo(_Model): """The resource management error additional info. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar type: The additional info type. :vartype type: str :ivar info: The additional info. @@ -135,11 +137,9 @@ class ErrorAdditionalInfo(_model_base.Model): """The additional info.""" -class ErrorDetail(_model_base.Model): +class ErrorDetail(_Model): """The error detail. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar code: The error code. :vartype code: str :ivar message: The error message. @@ -166,15 +166,14 @@ class ErrorDetail(_model_base.Model): """The error additional info.""" -class ErrorResponse(_model_base.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. +class ErrorResponse(_Model): + """Error response. :ivar error: The error object. :vartype error: ~azure.mgmt.fabric.models.ErrorDetail """ - error: Optional["_models.ErrorDetail"] = rest_field() + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The error object.""" @overload @@ -191,17 +190,15 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Resource(_model_base.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Readonly variables are only populated by the server, and will be ignored when sending a request. +class Resource(_Model): + """Resource. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -215,7 +212,7 @@ class Resource(_model_base.Model): id: Optional[str] = rest_field(visibility=["read"]) """Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long""" + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" name: Optional[str] = rest_field(visibility=["read"]) """The name of the resource.""" type: Optional[str] = rest_field(visibility=["read"]) @@ -226,14 +223,10 @@ class Resource(_model_base.Model): class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Readonly variables are only populated by the server, and will be ignored when sending a request. - + """Tracked Resource. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -249,7 +242,7 @@ class TrackedResource(Resource): :vartype location: str """ - tags: Optional[Dict[str, str]] = rest_field() + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" location: str = rest_field(visibility=["read", "create"]) """The geo-location where the resource lives. Required.""" @@ -269,18 +262,15 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) class FabricCapacity(TrackedResource): """Fabric Capacity resource. - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -300,9 +290,11 @@ class FabricCapacity(TrackedResource): :vartype sku: ~azure.mgmt.fabric.models.RpSku """ - properties: "_models.FabricCapacityProperties" = rest_field() + properties: "_models.FabricCapacityProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource. Required.""" - sku: "_models.RpSku" = rest_field() + sku: "_models.RpSku" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The SKU details. Required.""" @overload @@ -322,16 +314,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FabricCapacityProperties(_model_base.Model): +class FabricCapacityProperties(_Model): """The Microsoft Fabric capacity properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: The current deployment state of Microsoft Fabric resource. The provisioningState is to indicate states for resource provisioning. Known values are: "Succeeded", "Failed", "Canceled", "Deleting", "Provisioning", and "Updating". @@ -356,7 +345,9 @@ class FabricCapacityProperties(_model_base.Model): resource provisioning. Known values are: \"Active\", \"Provisioning\", \"Failed\", \"Updating\", \"Deleting\", \"Suspending\", \"Suspended\", \"Pausing\", \"Paused\", \"Resuming\", \"Scaling\", and \"Preparing\".""" - administration: "_models.CapacityAdministration" = rest_field() + administration: "_models.CapacityAdministration" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The capacity administration. Required.""" @overload @@ -373,11 +364,11 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FabricCapacityUpdate(_model_base.Model): +class FabricCapacityUpdate(_Model): """The type used for update operations of the FabricCapacity. :ivar sku: The SKU details. @@ -388,11 +379,13 @@ class FabricCapacityUpdate(_model_base.Model): :vartype properties: ~azure.mgmt.fabric.models.FabricCapacityUpdateProperties """ - sku: Optional["_models.RpSku"] = rest_field() + sku: Optional["_models.RpSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The SKU details.""" - tags: Optional[Dict[str, str]] = rest_field() + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Resource tags.""" - properties: Optional["_models.FabricCapacityUpdateProperties"] = rest_field() + properties: Optional["_models.FabricCapacityUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The resource-specific properties for this resource.""" @overload @@ -411,18 +404,20 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class FabricCapacityUpdateProperties(_model_base.Model): +class FabricCapacityUpdateProperties(_Model): """The updatable properties of the FabricCapacity. :ivar administration: The capacity administration. :vartype administration: ~azure.mgmt.fabric.models.CapacityAdministration """ - administration: Optional["_models.CapacityAdministration"] = rest_field() + administration: Optional["_models.CapacityAdministration"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """The capacity administration.""" @overload @@ -439,14 +434,12 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Operation(_model_base.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Readonly variables are only populated by the server, and will be ignored when sending a request. +class Operation(_Model): + """REST API Operation. :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". @@ -472,13 +465,15 @@ class Operation(_model_base.Model): is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and \"false\" for Azure Resource Manager/control-plane operations.""" - display: Optional["_models.OperationDisplay"] = rest_field(visibility=["read"]) + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) """Localized display information for this particular operation.""" origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and \"user,system\".""" - action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType") + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for internal only APIs. \"Internal\"""" @@ -486,7 +481,7 @@ class Operation(_model_base.Model): def __init__( self, *, - action_type: Optional[Union[str, "_models.ActionType"]] = None, + display: Optional["_models.OperationDisplay"] = None, ) -> None: ... @overload @@ -496,15 +491,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class OperationDisplay(_model_base.Model): +class OperationDisplay(_Model): """Localized display information for and operation. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". :vartype provider: str @@ -533,9 +526,85 @@ class OperationDisplay(_model_base.Model): views.""" -class RpSku(_model_base.Model): - """Represents the SKU name and Azure pricing tier for Microsoft Fabric capacity resource. +class Quota(_Model): + """Describes Resource Quota. + + :ivar name: The name of the quota. + :vartype name: ~azure.mgmt.fabric.models.QuotaName + :ivar unit: The unit of usage measurement. Required. + :vartype unit: str + :ivar current_value: The current usage of the resource. Required. + :vartype current_value: int + :ivar limit: The maximum permitted usage of the resource. Required. + :vartype limit: int + """ + + name: Optional["_models.QuotaName"] = rest_field(visibility=["read"]) + """The name of the quota.""" + unit: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unit of usage measurement. Required.""" + current_value: int = rest_field(name="currentValue", visibility=["read", "create", "update", "delete", "query"]) + """The current usage of the resource. Required.""" + limit: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The maximum permitted usage of the resource. Required.""" + @overload + def __init__( + self, + *, + unit: str, + current_value: int, + limit: int, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class QuotaName(_Model): + """The Quota Names. + + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str + """ + + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the resource.""" + localized_value: Optional[str] = rest_field( + name="localizedValue", visibility=["read", "create", "update", "delete", "query"] + ) + """The localized name of the resource.""" + + @overload + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RpSku(_Model): + """Represents the SKU name and Azure pricing tier for Microsoft Fabric capacity resource. :ivar name: The name of the SKU level. Required. :vartype name: str @@ -543,9 +612,9 @@ class RpSku(_model_base.Model): :vartype tier: str or ~azure.mgmt.fabric.models.RpSkuTier """ - name: str = rest_field() + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The name of the SKU level. Required.""" - tier: Union[str, "_models.RpSkuTier"] = rest_field() + tier: Union[str, "_models.RpSkuTier"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The name of the Azure pricing tier to which the SKU applies. Required. \"Fabric\"""" @overload @@ -563,23 +632,22 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RpSkuDetailsForExistingResource(_model_base.Model): +class RpSkuDetailsForExistingResource(_Model): """An object that represents SKU details for existing resources. - :ivar resource_type: The resource type. Required. :vartype resource_type: str :ivar sku: The SKU details. Required. :vartype sku: ~azure.mgmt.fabric.models.RpSku """ - resource_type: str = rest_field(name="resourceType") + resource_type: str = rest_field(name="resourceType", visibility=["read", "create", "update", "delete", "query"]) """The resource type. Required.""" - sku: "_models.RpSku" = rest_field() + sku: "_models.RpSku" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The SKU details. Required.""" @overload @@ -597,14 +665,13 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RpSkuDetailsForNewResource(_model_base.Model): +class RpSkuDetailsForNewResource(_Model): """The SKU details. - :ivar resource_type: The resource type. Required. :vartype resource_type: str :ivar name: The SKU's name. Required. @@ -613,11 +680,11 @@ class RpSkuDetailsForNewResource(_model_base.Model): :vartype locations: list[str] """ - resource_type: str = rest_field(name="resourceType") + resource_type: str = rest_field(name="resourceType", visibility=["read", "create", "update", "delete", "query"]) """The resource type. Required.""" - name: str = rest_field() + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The SKU's name. Required.""" - locations: List[str] = rest_field() + locations: List[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) """The list of available locations for the SKU. Required.""" @overload @@ -636,11 +703,11 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class SystemData(_model_base.Model): +class SystemData(_Model): """Metadata pertaining to creation and last modification of the resource. :ivar created_by: The identity that created the resource. @@ -659,19 +726,29 @@ class SystemData(_model_base.Model): :vartype last_modified_at: ~datetime.datetime """ - created_by: Optional[str] = rest_field(name="createdBy") + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) """The identity that created the resource.""" - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(name="createdByType") + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) """The type of identity that created the resource. Known values are: \"User\", \"Application\", \"ManagedIdentity\", and \"Key\".""" - created_at: Optional[datetime.datetime] = rest_field(name="createdAt", format="rfc3339") + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp of resource creation (UTC).""" - last_modified_by: Optional[str] = rest_field(name="lastModifiedBy") + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) """The identity that last modified the resource.""" - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field(name="lastModifiedByType") + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) """The type of identity that last modified the resource. Known values are: \"User\", \"Application\", \"ManagedIdentity\", and \"Key\".""" - last_modified_at: Optional[datetime.datetime] = rest_field(name="lastModifiedAt", format="rfc3339") + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) """The timestamp of resource last modification (UTC).""" @overload @@ -693,5 +770,5 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: :type mapping: Mapping[str, Any] """ - def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useless-super-delegation + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/models/_patch.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/models/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/models/_patch.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/models/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/operations/__init__.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/operations/__init__.py index 29912dd9df22..5c4a04ad0951 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/operations/__init__.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/operations/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import FabricCapacitiesOperations -from ._operations import Operations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import FabricCapacitiesOperations # type: ignore +from ._operations import Operations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/operations/_operations.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/operations/_operations.py index 01fb0e2a5e92..1cc18912177b 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/operations/_operations.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,12 +6,13 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase import json -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -32,14 +33,11 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._model_base import SdkJSONEncoder, _deserialize -from .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +from .._configuration import FabricMgmtClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._utils.serialization import Deserializer, Serializer + +JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,11 +51,11 @@ def build_fabric_capacities_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", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -82,11 +80,11 @@ def build_fabric_capacities_create_or_update_request( # pylint: disable=name-to _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", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -113,11 +111,11 @@ def build_fabric_capacities_update_request( _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", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -143,11 +141,11 @@ def build_fabric_capacities_delete_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", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -171,7 +169,7 @@ def build_fabric_capacities_list_by_resource_group_request( # pylint: disable=n _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +196,7 @@ def build_fabric_capacities_list_by_subscription_request( # pylint: disable=nam _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -224,11 +222,11 @@ def build_fabric_capacities_resume_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", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/resume" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/resume" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -252,11 +250,11 @@ def build_fabric_capacities_suspend_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", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/suspend" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/suspend" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -281,7 +279,7 @@ def build_fabric_capacities_check_name_availability_request( # pylint: disable= _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", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -310,11 +308,11 @@ def build_fabric_capacities_list_skus_for_capacity_request( # pylint: disable=n _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/skus" # pylint: disable=line-too-long + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Fabric/capacities/{capacityName}/skus" path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -338,7 +336,7 @@ def build_fabric_capacities_list_skus_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", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -358,11 +356,38 @@ def build_fabric_capacities_list_skus_request( # pylint: disable=name-too-long return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_fabric_capacities_list_usages_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-15-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Fabric/locations/{location}/usages" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -387,12 +412,12 @@ class FabricCapacitiesOperations: :attr:`fabric_capacities` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: FabricMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_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 def get(self, resource_group_name: str, capacity_name: str, **kwargs: Any) -> _models.FabricCapacity: @@ -448,7 +473,7 @@ def get(self, resource_group_name: str, capacity_name: str, **kwargs: Any) -> _m except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -517,7 +542,7 @@ def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -753,7 +778,7 @@ def _update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -971,7 +996,7 @@ def _delete_initial(self, resource_group_name: str, capacity_name: str, **kwargs except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1109,7 +1134,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.FabricCapacity], deserialized["value"]) + list_of_elem = _deserialize(List[_models.FabricCapacity], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1125,7 +1150,7 @@ 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 = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1193,7 +1218,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.FabricCapacity], deserialized["value"]) + list_of_elem = _deserialize(List[_models.FabricCapacity], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1209,7 +1234,7 @@ 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 = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1256,7 +1281,7 @@ def _resume_initial(self, resource_group_name: str, capacity_name: str, **kwargs except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1369,7 +1394,7 @@ def _suspend_initial(self, resource_group_name: str, capacity_name: str, **kwarg except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1569,7 +1594,7 @@ def check_name_availability( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if _stream: @@ -1652,7 +1677,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.RpSkuDetailsForExistingResource], deserialized["value"]) + list_of_elem = _deserialize(List[_models.RpSkuDetailsForExistingResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1668,7 +1693,7 @@ 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 = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1736,7 +1761,94 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.RpSkuDetailsForNewResource], deserialized["value"]) + list_of_elem = _deserialize(List[_models.RpSkuDetailsForNewResource], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_usages(self, location: str, **kwargs: Any) -> Iterable["_models.Quota"]: + """List the current consumption and limit in this location for the provided subscription. + + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of Quota + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.fabric.models.Quota] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Quota]] = 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_fabric_capacities_list_usages_request( + location=location, + 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.Quota], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1752,7 +1864,7 @@ 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 = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1770,12 +1882,12 @@ class Operations: :attr:`operations` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: FabricMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_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 def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -1837,7 +1949,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Operation], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1853,7 +1965,7 @@ 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 = _deserialize(_models.ErrorResponse, response.json()) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/operations/_patch.py b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/operations/_patch.py +++ b/sdk/fabric/azure-mgmt-fabric/azure/mgmt/fabric/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_check_name_availability.py b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_check_name_availability.py index 6a1e46d7e158..3fe40dbf025d 100644 --- a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_check_name_availability.py +++ b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_check_name_availability.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2023-11-01/FabricCapacities_CheckNameAvailability.json +# x-ms-original-file: 2025-01-15-preview/FabricCapacities_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_create_or_update.py b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_create_or_update.py index cdafea096322..9501df909d1e 100644 --- a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_create_or_update.py +++ b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_create_or_update.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: 2023-11-01/FabricCapacities_CreateOrUpdate.json +# x-ms-original-file: 2025-01-15-preview/FabricCapacities_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_delete.py b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_delete.py index 91977e9351bf..ad46ce8930bf 100644 --- a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_delete.py +++ b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: 2023-11-01/FabricCapacities_Delete.json +# x-ms-original-file: 2025-01-15-preview/FabricCapacities_Delete.json if __name__ == "__main__": main() diff --git a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_get.py b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_get.py index 7fd92386ae66..04d5f6c2d27a 100644 --- a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_get.py +++ b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: 2023-11-01/FabricCapacities_Get.json +# x-ms-original-file: 2025-01-15-preview/FabricCapacities_Get.json if __name__ == "__main__": main() diff --git a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_by_resource_group.py b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_by_resource_group.py index 0e3c743cc7b8..0889c8847c00 100644 --- a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_by_resource_group.py +++ b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: 2023-11-01/FabricCapacities_ListByResourceGroup.json +# x-ms-original-file: 2025-01-15-preview/FabricCapacities_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_by_subscription.py b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_by_subscription.py index 58d7b7eb071d..a07836f9c875 100644 --- a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_by_subscription.py +++ b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2023-11-01/FabricCapacities_ListBySubscription.json +# x-ms-original-file: 2025-01-15-preview/FabricCapacities_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_skus.py b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_skus.py index 84586fe550b2..3aac97041594 100644 --- a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_skus.py +++ b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_skus.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2023-11-01/FabricCapacities_ListSkus.json +# x-ms-original-file: 2025-01-15-preview/FabricCapacities_ListSkus.json if __name__ == "__main__": main() diff --git a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_skus_for_capacity.py b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_skus_for_capacity.py index 60d85b58fbd7..bd446e5c20d9 100644 --- a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_skus_for_capacity.py +++ b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_skus_for_capacity.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: 2023-11-01/FabricCapacities_ListSkusForCapacity.json +# x-ms-original-file: 2025-01-15-preview/FabricCapacities_ListSkusForCapacity.json if __name__ == "__main__": main() diff --git a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_usages_by_subscription.py b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_usages_by_subscription.py new file mode 100644 index 000000000000..21a326ea87c0 --- /dev/null +++ b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_list_usages_by_subscription.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.fabric import FabricMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-fabric +# USAGE + python fabric_capacities_list_usages_by_subscription.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 = FabricMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.fabric_capacities.list_usages( + location="centraluseuap", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-01-15-preview/FabricCapacities_ListUsagesBySubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_resume.py b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_resume.py index a9d11899de2a..fb2e4481c442 100644 --- a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_resume.py +++ b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_resume.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: 2023-11-01/FabricCapacities_Resume.json +# x-ms-original-file: 2025-01-15-preview/FabricCapacities_Resume.json if __name__ == "__main__": main() diff --git a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_suspend.py b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_suspend.py index 9c444d40fac0..6f80181ee7fe 100644 --- a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_suspend.py +++ b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_suspend.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: 2023-11-01/FabricCapacities_Suspend.json +# x-ms-original-file: 2025-01-15-preview/FabricCapacities_Suspend.json if __name__ == "__main__": main() diff --git a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_update.py b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_update.py index 408f8c6cb43c..89b041148812 100644 --- a/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_update.py +++ b/sdk/fabric/azure-mgmt-fabric/generated_samples/fabric_capacities_update.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: 2023-11-01/FabricCapacities_Update.json +# x-ms-original-file: 2025-01-15-preview/FabricCapacities_Update.json if __name__ == "__main__": main() diff --git a/sdk/fabric/azure-mgmt-fabric/generated_samples/operations_list.py b/sdk/fabric/azure-mgmt-fabric/generated_samples/operations_list.py index 665744cf3829..2abe1815f11d 100644 --- a/sdk/fabric/azure-mgmt-fabric/generated_samples/operations_list.py +++ b/sdk/fabric/azure-mgmt-fabric/generated_samples/operations_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: 2023-11-01/Operations_List.json +# x-ms-original-file: 2025-01-15-preview/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/fabric/azure-mgmt-fabric/generated_tests/test_fabric_mgmt_fabric_capacities_operations.py b/sdk/fabric/azure-mgmt-fabric/generated_tests/test_fabric_mgmt_fabric_capacities_operations.py index 422835a941e6..3ef0700366ab 100644 --- a/sdk/fabric/azure-mgmt-fabric/generated_tests/test_fabric_mgmt_fabric_capacities_operations.py +++ b/sdk/fabric/azure-mgmt-fabric/generated_tests/test_fabric_mgmt_fabric_capacities_operations.py @@ -153,3 +153,13 @@ def test_fabric_capacities_list_skus(self, resource_group): result = [r for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_fabric_capacities_list_usages(self, resource_group): + response = self.client.fabric_capacities.list_usages( + location="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/fabric/azure-mgmt-fabric/generated_tests/test_fabric_mgmt_fabric_capacities_operations_async.py b/sdk/fabric/azure-mgmt-fabric/generated_tests/test_fabric_mgmt_fabric_capacities_operations_async.py index 2414c137dba4..4ecd8b26e471 100644 --- a/sdk/fabric/azure-mgmt-fabric/generated_tests/test_fabric_mgmt_fabric_capacities_operations_async.py +++ b/sdk/fabric/azure-mgmt-fabric/generated_tests/test_fabric_mgmt_fabric_capacities_operations_async.py @@ -164,3 +164,13 @@ async def test_fabric_capacities_list_skus(self, resource_group): 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_fabric_capacities_list_usages(self, resource_group): + response = self.client.fabric_capacities.list_usages( + location="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/fabric/azure-mgmt-fabric/sdk_packaging.toml b/sdk/fabric/azure-mgmt-fabric/sdk_packaging.toml index c79e9166bd21..a73d922c4c16 100644 --- a/sdk/fabric/azure-mgmt-fabric/sdk_packaging.toml +++ b/sdk/fabric/azure-mgmt-fabric/sdk_packaging.toml @@ -3,7 +3,7 @@ package_name = "azure-mgmt-fabric" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Fabric Management" package_doc_id = "" -is_stable = true +is_stable = false is_arm = true need_msrestazure = false need_azuremgmtcore = true diff --git a/sdk/fabric/azure-mgmt-fabric/setup.py b/sdk/fabric/azure-mgmt-fabric/setup.py index 56b5f718a923..ebbdbbf43220 100644 --- a/sdk/fabric/azure-mgmt-fabric/setup.py +++ b/sdk/fabric/azure-mgmt-fabric/setup.py @@ -49,11 +49,10 @@ url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -77,7 +76,7 @@ "isodate>=0.6.1", "typing-extensions>=4.6.0", "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.8", + python_requires=">=3.9", ) diff --git a/sdk/fabric/azure-mgmt-fabric/tsp-location.yaml b/sdk/fabric/azure-mgmt-fabric/tsp-location.yaml index 70bb9c371953..72deb27a0de5 100644 --- a/sdk/fabric/azure-mgmt-fabric/tsp-location.yaml +++ b/sdk/fabric/azure-mgmt-fabric/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/fabric/Microsoft.Fabric.Management -commit: 9ce76c4f113368361dac4de5d0a71eb058602756 +commit: b9a8c9e8eb8998a222f126a005d1ab633f1daad9 repo: Azure/azure-rest-api-specs additionalDirectories: