From ad343a198eb5c2e1cd6198f50b3597093c82149c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 13 May 2025 10:46:34 +0000 Subject: [PATCH] CodeGen from PR 34270 in Azure/azure-rest-api-specs Merge c5c31b0506df39bc9e78f53a9678914719c1964d into a19648565889eaae019e531c15f3045d1244c7ce --- .../azure-mgmt-deviceregistry/README.md | 6 +- .../azure-mgmt-deviceregistry/_meta.json | 4 +- .../apiview-properties.json | 48 ++++-- .../azure/mgmt/deviceregistry/_client.py | 28 ++-- .../azure/mgmt/deviceregistry/_patch.py | 9 +- .../mgmt/deviceregistry/_utils/__init__.py | 6 + .../{_model_base.py => _utils/model_base.py} | 27 ++-- .../serialization.py} | 28 +--- .../azure/mgmt/deviceregistry/_version.py | 2 +- .../azure/mgmt/deviceregistry/aio/_client.py | 30 ++-- .../azure/mgmt/deviceregistry/aio/_patch.py | 9 +- .../aio/operations/_operations.py | 90 ++---------- .../deviceregistry/aio/operations/_patch.py | 9 +- .../mgmt/deviceregistry/models/_models.py | 137 +++++------------- .../mgmt/deviceregistry/models/_patch.py | 9 +- .../deviceregistry/operations/_operations.py | 100 +++---------- .../mgmt/deviceregistry/operations/_patch.py | 9 +- .../sdk_packaging.toml | 2 +- .../azure-mgmt-deviceregistry/setup.py | 5 +- .../tsp-location.yaml | 2 +- 20 files changed, 193 insertions(+), 367 deletions(-) create mode 100644 sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_utils/__init__.py rename sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/{_model_base.py => _utils/model_base.py} (98%) rename sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/{_serialization.py => _utils/serialization.py} (98%) diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/README.md b/sdk/deviceregistry/azure-mgmt-deviceregistry/README.md index 785eba4ed04c..87b5accf476a 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/README.md +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Deviceregistry 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/deviceregistry/azure-mgmt-deviceregistry/_meta.json b/sdk/deviceregistry/azure-mgmt-deviceregistry/_meta.json index 9dd89c8226c2..93dfe0325880 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/_meta.json +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/_meta.json @@ -1,6 +1,6 @@ { - "commit": "812060f2268dc35ed8866bcbaf94aa767cf87c8d", + "commit": "079f70d6f2b754db6b736e117196104efd2dd496", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/deviceregistry/DeviceRegistry.Management", - "@azure-tools/typespec-python": "0.38.4" + "@azure-tools/typespec-python": "0.44.2" } \ No newline at end of file diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/apiview-properties.json b/sdk/deviceregistry/azure-mgmt-deviceregistry/apiview-properties.json index d31b729cafd3..d386d9eb70ff 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/apiview-properties.json +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/apiview-properties.json @@ -46,21 +46,37 @@ "azure.mgmt.deviceregistry.models.EventObservabilityMode": "Microsoft.DeviceRegistry.EventObservabilityMode", "azure.mgmt.deviceregistry.models.ProvisioningState": "Microsoft.DeviceRegistry.ProvisioningState", "azure.mgmt.deviceregistry.models.AuthenticationMethod": "Microsoft.DeviceRegistry.AuthenticationMethod", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.operations.list": "Azure.ResourceManager.Operations.list", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.operation_status.get": "Microsoft.DeviceRegistry.OperationStatus.get", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.get": "Microsoft.DeviceRegistry.Assets.get", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.begin_create_or_replace": "Microsoft.DeviceRegistry.Assets.createOrReplace", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.begin_update": "Microsoft.DeviceRegistry.Assets.update", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.begin_delete": "Microsoft.DeviceRegistry.Assets.delete", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.list_by_resource_group": "Microsoft.DeviceRegistry.Assets.listByResourceGroup", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.list_by_subscription": "Microsoft.DeviceRegistry.Assets.listBySubscription", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.get": "Microsoft.DeviceRegistry.AssetEndpointProfiles.get", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.begin_create_or_replace": "Microsoft.DeviceRegistry.AssetEndpointProfiles.createOrReplace", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.begin_update": "Microsoft.DeviceRegistry.AssetEndpointProfiles.update", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.begin_delete": "Microsoft.DeviceRegistry.AssetEndpointProfiles.delete", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.list_by_resource_group": "Microsoft.DeviceRegistry.AssetEndpointProfiles.listByResourceGroup", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.list_by_subscription": "Microsoft.DeviceRegistry.AssetEndpointProfiles.listBySubscription", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.billing_containers.get": "Microsoft.DeviceRegistry.BillingContainers.get", - "azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.billing_containers.list_by_subscription": "Microsoft.DeviceRegistry.BillingContainers.listBySubscription" + "azure.mgmt.deviceregistry.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.deviceregistry.aio.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.deviceregistry.operations.OperationStatusOperations.get": "Microsoft.DeviceRegistry.OperationStatus.get", + "azure.mgmt.deviceregistry.aio.operations.OperationStatusOperations.get": "Microsoft.DeviceRegistry.OperationStatus.get", + "azure.mgmt.deviceregistry.operations.AssetsOperations.get": "Microsoft.DeviceRegistry.Assets.get", + "azure.mgmt.deviceregistry.aio.operations.AssetsOperations.get": "Microsoft.DeviceRegistry.Assets.get", + "azure.mgmt.deviceregistry.operations.AssetsOperations.begin_create_or_replace": "Microsoft.DeviceRegistry.Assets.createOrReplace", + "azure.mgmt.deviceregistry.aio.operations.AssetsOperations.begin_create_or_replace": "Microsoft.DeviceRegistry.Assets.createOrReplace", + "azure.mgmt.deviceregistry.operations.AssetsOperations.begin_update": "Microsoft.DeviceRegistry.Assets.update", + "azure.mgmt.deviceregistry.aio.operations.AssetsOperations.begin_update": "Microsoft.DeviceRegistry.Assets.update", + "azure.mgmt.deviceregistry.operations.AssetsOperations.begin_delete": "Microsoft.DeviceRegistry.Assets.delete", + "azure.mgmt.deviceregistry.aio.operations.AssetsOperations.begin_delete": "Microsoft.DeviceRegistry.Assets.delete", + "azure.mgmt.deviceregistry.operations.AssetsOperations.list_by_resource_group": "Microsoft.DeviceRegistry.Assets.listByResourceGroup", + "azure.mgmt.deviceregistry.aio.operations.AssetsOperations.list_by_resource_group": "Microsoft.DeviceRegistry.Assets.listByResourceGroup", + "azure.mgmt.deviceregistry.operations.AssetsOperations.list_by_subscription": "Microsoft.DeviceRegistry.Assets.listBySubscription", + "azure.mgmt.deviceregistry.aio.operations.AssetsOperations.list_by_subscription": "Microsoft.DeviceRegistry.Assets.listBySubscription", + "azure.mgmt.deviceregistry.operations.AssetEndpointProfilesOperations.get": "Microsoft.DeviceRegistry.AssetEndpointProfiles.get", + "azure.mgmt.deviceregistry.aio.operations.AssetEndpointProfilesOperations.get": "Microsoft.DeviceRegistry.AssetEndpointProfiles.get", + "azure.mgmt.deviceregistry.operations.AssetEndpointProfilesOperations.begin_create_or_replace": "Microsoft.DeviceRegistry.AssetEndpointProfiles.createOrReplace", + "azure.mgmt.deviceregistry.aio.operations.AssetEndpointProfilesOperations.begin_create_or_replace": "Microsoft.DeviceRegistry.AssetEndpointProfiles.createOrReplace", + "azure.mgmt.deviceregistry.operations.AssetEndpointProfilesOperations.begin_update": "Microsoft.DeviceRegistry.AssetEndpointProfiles.update", + "azure.mgmt.deviceregistry.aio.operations.AssetEndpointProfilesOperations.begin_update": "Microsoft.DeviceRegistry.AssetEndpointProfiles.update", + "azure.mgmt.deviceregistry.operations.AssetEndpointProfilesOperations.begin_delete": "Microsoft.DeviceRegistry.AssetEndpointProfiles.delete", + "azure.mgmt.deviceregistry.aio.operations.AssetEndpointProfilesOperations.begin_delete": "Microsoft.DeviceRegistry.AssetEndpointProfiles.delete", + "azure.mgmt.deviceregistry.operations.AssetEndpointProfilesOperations.list_by_resource_group": "Microsoft.DeviceRegistry.AssetEndpointProfiles.listByResourceGroup", + "azure.mgmt.deviceregistry.aio.operations.AssetEndpointProfilesOperations.list_by_resource_group": "Microsoft.DeviceRegistry.AssetEndpointProfiles.listByResourceGroup", + "azure.mgmt.deviceregistry.operations.AssetEndpointProfilesOperations.list_by_subscription": "Microsoft.DeviceRegistry.AssetEndpointProfiles.listBySubscription", + "azure.mgmt.deviceregistry.aio.operations.AssetEndpointProfilesOperations.list_by_subscription": "Microsoft.DeviceRegistry.AssetEndpointProfiles.listBySubscription", + "azure.mgmt.deviceregistry.operations.BillingContainersOperations.get": "Microsoft.DeviceRegistry.BillingContainers.get", + "azure.mgmt.deviceregistry.aio.operations.BillingContainersOperations.get": "Microsoft.DeviceRegistry.BillingContainers.get", + "azure.mgmt.deviceregistry.operations.BillingContainersOperations.list_by_subscription": "Microsoft.DeviceRegistry.BillingContainers.listBySubscription", + "azure.mgmt.deviceregistry.aio.operations.BillingContainersOperations.list_by_subscription": "Microsoft.DeviceRegistry.BillingContainers.listBySubscription" } } \ No newline at end of file diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_client.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_client.py index f55bd4306368..814ec35b0a40 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_client.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_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 DeviceRegistryMgmtClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer from .operations import ( AssetEndpointProfilesOperations, AssetsOperations, @@ -47,7 +49,7 @@ class DeviceRegistryMgmtClient: :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 "2024-11-01". Note that overriding this default value may result in unsupported behavior. @@ -57,16 +59,22 @@ class DeviceRegistryMgmtClient: """ 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 = DeviceRegistryMgmtClientConfiguration( - 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 = [ @@ -85,7 +93,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=_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/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_patch.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_patch.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_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/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_utils/__init__.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_utils/__init__.py new file mode 100644 index 000000000000..8026245c2abc --- /dev/null +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_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/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_model_base.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_utils/model_base.py similarity index 98% rename from sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_model_base.py rename to sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_utils/model_base.py index 3072ee252ed9..49d5c7259389 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_model_base.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_utils/model_base.py @@ -2,8 +2,9 @@ # 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, broad-except @@ -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 @@ -407,13 +404,13 @@ def get(self, key: str, default: typing.Any = None) -> typing.Any: 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: """ @@ -443,7 +440,7 @@ def clear(self) -> None: """ 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. @@ -454,7 +451,7 @@ def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: 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: """ @@ -644,7 +641,7 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: 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__: @@ -680,7 +677,7 @@ def _deserialize(cls, data, exist_discriminators): discriminator_value = data.find(xml_name).text # pyright: ignore else: discriminator_value = data.get(discriminator._rest_name) - mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member return mapped_cls._deserialize(data, exist_discriminators) def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]: diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_serialization.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_utils/serialization.py similarity index 98% rename from sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_serialization.py rename to sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_utils/serialization.py index e2a20b1d534c..eb86ea23c965 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_serialization.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_utils/serialization.py @@ -1,28 +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 @@ -411,7 +393,7 @@ 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 + :raises DeserializationError: if something went wrong :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_version.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_version.py index 0ec13ea52bbf..be71c81bd282 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_version.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_client.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_client.py index f64c7b20c23c..c75c0c3dc0e3 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_client.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/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 DeviceRegistryMgmtClientConfiguration from .operations import ( AssetEndpointProfilesOperations, @@ -48,7 +50,7 @@ class DeviceRegistryMgmtClient: :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 "2024-11-01". Note that overriding this default value may result in unsupported behavior. @@ -58,16 +60,22 @@ class DeviceRegistryMgmtClient: """ 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 = DeviceRegistryMgmtClientConfiguration( - 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 = [ @@ -86,7 +94,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/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_patch.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/_patch.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/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/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_operations.py index 4fc1b5061e20..c356da89a7cf 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_operations.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_operations.py @@ -6,9 +6,9 @@ # 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 @@ -34,8 +34,8 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize -from ..._serialization import Deserializer, Serializer +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.serialization import Deserializer, Serializer from ..._validation import api_version_validation from ...operations._operations import ( build_asset_endpoint_profiles_create_or_replace_request, @@ -57,13 +57,9 @@ ) from .._configuration import DeviceRegistryMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -84,9 +80,6 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """List the operations for the provider. @@ -146,7 +139,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) @@ -188,9 +181,6 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.OperationStatusResult: """Returns the current status of an async operation. @@ -274,9 +264,6 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) async def get(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> _models.Asset: """Get a Asset. @@ -342,9 +329,6 @@ async def get(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> return deserialized # type: ignore - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) async def _create_or_replace_initial( self, resource_group_name: str, asset_name: str, resource: Union[_models.Asset, JSON, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: @@ -499,9 +483,6 @@ async def begin_create_or_replace( """ @distributed_trace_async - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) async def begin_create_or_replace( self, resource_group_name: str, asset_name: str, resource: Union[_models.Asset, JSON, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Asset]: @@ -572,9 +553,6 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) async def _update_initial( self, resource_group_name: str, @@ -731,9 +709,6 @@ async def begin_update( """ @distributed_trace_async - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) async def begin_update( self, resource_group_name: str, @@ -808,9 +783,6 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) async def _delete_initial(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -867,9 +839,6 @@ async def _delete_initial(self, resource_group_name: str, asset_name: str, **kwa return deserialized # type: ignore @distributed_trace_async - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) async def begin_delete(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Delete a Asset. @@ -927,9 +896,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Asset"]: """List Asset resources by resource group. @@ -994,7 +960,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.Asset], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Asset], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1018,9 +984,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Asset"]: """List Asset resources by subscription ID. @@ -1081,7 +1044,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.Asset], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Asset], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1123,9 +1086,6 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) async def get( self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any ) -> _models.AssetEndpointProfile: @@ -1193,9 +1153,6 @@ async def get( return deserialized # type: ignore - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) async def _create_or_replace_initial( self, resource_group_name: str, @@ -1357,9 +1314,6 @@ async def begin_create_or_replace( """ @distributed_trace_async - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) async def begin_create_or_replace( self, resource_group_name: str, @@ -1435,9 +1389,6 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) async def _update_initial( self, resource_group_name: str, @@ -1597,9 +1548,6 @@ async def begin_update( """ @distributed_trace_async - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) async def begin_update( self, resource_group_name: str, @@ -1676,9 +1624,6 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) async def _delete_initial( self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: @@ -1737,9 +1682,6 @@ async def _delete_initial( return deserialized # type: ignore @distributed_trace_async - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) async def begin_delete( self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: @@ -1799,9 +1741,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def list_by_resource_group( self, resource_group_name: str, **kwargs: Any ) -> AsyncIterable["_models.AssetEndpointProfile"]: @@ -1869,7 +1808,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.AssetEndpointProfile], deserialized["value"]) + list_of_elem = _deserialize(List[_models.AssetEndpointProfile], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1893,9 +1832,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.AssetEndpointProfile"]: """List AssetEndpointProfile resources by subscription ID. @@ -1957,7 +1893,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.AssetEndpointProfile], deserialized["value"]) + list_of_elem = _deserialize(List[_models.AssetEndpointProfile], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -2001,9 +1937,7 @@ def __init__(self, *args, **kwargs) -> None: @distributed_trace_async @api_version_validation( method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "billing_container_name", "accept"] - }, + params_added_on={"2024-09-01-preview": ["api_version", "subscription_id", "billing_container_name", "accept"]}, ) async def get(self, billing_container_name: str, **kwargs: Any) -> _models.BillingContainer: """Get a BillingContainer. @@ -2069,7 +2003,7 @@ async def get(self, billing_container_name: str, **kwargs: Any) -> _models.Billi @distributed_trace @api_version_validation( method_added_on="2024-09-01-preview", - params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, + params_added_on={"2024-09-01-preview": ["api_version", "subscription_id", "accept"]}, ) def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.BillingContainer"]: """List BillingContainer resources by subscription ID. @@ -2132,7 +2066,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.BillingContainer], deserialized["value"]) + list_of_elem = _deserialize(List[_models.BillingContainer], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_patch.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/aio/operations/_patch.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/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/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_models.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_models.py index 1e48551e1d25..01485b0506bb 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_models.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_models.py @@ -11,17 +11,14 @@ 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 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}. @@ -49,11 +46,7 @@ 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}. @@ -99,9 +92,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class Asset(TrackedResource): """Asset definition. - 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}. :vartype id: str @@ -154,9 +144,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class AssetEndpointProfile(TrackedResource): """Asset Endpoint Profile definition. - 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}. :vartype id: str @@ -206,12 +193,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AssetEndpointProfileProperties(_model_base.Model): +class AssetEndpointProfileProperties(_Model): """Defines the Asset Endpoint Profile properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar uuid: Globally unique, immutable, non-reusable id. :vartype uuid: str :ivar target_address: The local valid URI specifying the network address/DNS name of a @@ -295,11 +279,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AssetEndpointProfileStatus(_model_base.Model): +class AssetEndpointProfileStatus(_Model): """Defines the asset endpoint profile status properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar errors: Array object to transfer and persist errors that originate from the Edge. :vartype errors: list[~azure.mgmt.deviceregistry.models.AssetEndpointProfileStatusError] """ @@ -308,11 +290,9 @@ class AssetEndpointProfileStatus(_model_base.Model): """Array object to transfer and persist errors that originate from the Edge.""" -class AssetEndpointProfileStatusError(_model_base.Model): +class AssetEndpointProfileStatusError(_Model): """Defines the asset endpoint profile status error properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar code: Error code for classification of errors (ex: 400, 404, 500, etc.). :vartype code: int :ivar message: Human readable helpful error message to provide additional context for error @@ -327,7 +307,7 @@ class AssetEndpointProfileStatusError(_model_base.Model): “targetAddress 'foo' is not a valid url”).""" -class AssetEndpointProfileUpdate(_model_base.Model): +class AssetEndpointProfileUpdate(_Model): """The type used for update operations of the AssetEndpointProfile. :ivar tags: Resource tags. @@ -362,7 +342,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AssetEndpointProfileUpdateProperties(_model_base.Model): +class AssetEndpointProfileUpdateProperties(_Model): """The updatable properties of the AssetEndpointProfile. :ivar target_address: The local valid URI specifying the network address/DNS name of a @@ -420,12 +400,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AssetProperties(_model_base.Model): +class AssetProperties(_Model): """Defines the asset properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar uuid: Globally unique, immutable, non-reusable id. :vartype uuid: str :ivar enabled: Enabled/Disabled status of the asset. @@ -603,11 +580,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AssetStatus(_model_base.Model): +class AssetStatus(_Model): """Defines the asset status properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar errors: Array object to transfer and persist errors that originate from the Edge. :vartype errors: list[~azure.mgmt.deviceregistry.models.AssetStatusError] :ivar version: A read only incremental counter indicating the number of times the configuration @@ -634,12 +609,9 @@ class AssetStatus(_model_base.Model): """Array of event statuses that describe the status of each event.""" -class AssetStatusDataset(_model_base.Model): +class AssetStatusDataset(_Model): """Defines the asset status dataset properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the dataset. Must be unique within the status.datasets array. This name is used to correlate between the spec and status dataset information. Required. :vartype name: str @@ -656,11 +628,9 @@ class AssetStatusDataset(_model_base.Model): """The message schema reference object.""" -class AssetStatusError(_model_base.Model): +class AssetStatusError(_Model): """Defines the asset status error properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar code: Error code for classification of errors (ex: 400, 404, 500, etc.). :vartype code: int :ivar message: Human readable helpful error message to provide additional context for error @@ -675,12 +645,9 @@ class AssetStatusError(_model_base.Model): Id 'foo' does not exist”).""" -class AssetStatusEvent(_model_base.Model): +class AssetStatusEvent(_Model): """Defines the asset status event properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the event. Must be unique within the status.events array. This name is used to correlate between the spec and status event information. Required. :vartype name: str @@ -697,7 +664,7 @@ class AssetStatusEvent(_model_base.Model): """The message schema reference object.""" -class AssetUpdate(_model_base.Model): +class AssetUpdate(_Model): """The type used for update operations of the Asset. :ivar tags: Resource tags. @@ -732,7 +699,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AssetUpdateProperties(_model_base.Model): +class AssetUpdateProperties(_Model): """The updatable properties of the Asset. :ivar enabled: Enabled/Disabled status of the asset. @@ -869,10 +836,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Authentication(_model_base.Model): +class Authentication(_Model): """Definition of the client authentication mechanism to the server. - :ivar method: Defines the method to authenticate the user of the client at the server. Required. Known values are: "Anonymous", "Certificate", and "UsernamePassword". :vartype method: str or ~azure.mgmt.deviceregistry.models.AuthenticationMethod @@ -921,10 +887,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Readonly variables are only populated by the server, and will be ignored when sending a request. + """Proxy Resource. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -944,8 +907,6 @@ class BillingContainer(ProxyResource): """billingContainer Model as Azure resource whose sole purpose is to keep track of billables resources under a subscription. - 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}. :vartype id: str @@ -988,11 +949,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class BillingContainerProperties(_model_base.Model): +class BillingContainerProperties(_Model): """Defines the billingContainer properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", "Failed", "Canceled", "Accepted", and "Deleting". :vartype provisioning_state: str or ~azure.mgmt.deviceregistry.models.ProvisioningState @@ -1005,10 +964,9 @@ class BillingContainerProperties(_model_base.Model): \"Accepted\", and \"Deleting\".""" -class DataPointBase(_model_base.Model): +class DataPointBase(_Model): """Defines the data point properties. - :ivar name: The name of the data point. Required. :vartype name: str :ivar data_source: The address of the source of the data in the asset (e.g. URL) so that a @@ -1054,7 +1012,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class DataPoint(DataPointBase): """Defines the data point properties. - :ivar name: The name of the data point. Required. :vartype name: str :ivar data_source: The address of the source of the data in the asset (e.g. URL) so that a @@ -1097,10 +1054,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Dataset(_model_base.Model): +class Dataset(_Model): """Defines the dataset properties. - :ivar name: Name of the dataset. Required. :vartype name: str :ivar dataset_configuration: Stringified JSON that contains connector-specific JSON string that @@ -1149,11 +1105,9 @@ 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. @@ -1166,11 +1120,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. @@ -1197,9 +1149,8 @@ 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.deviceregistry.models.ErrorDetail @@ -1226,10 +1177,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class EventBase(_model_base.Model): +class EventBase(_Model): """Defines the event properties. - :ivar name: The name of the event. Required. :vartype name: str :ivar event_notifier: The address of the notifier of the event in the asset (e.g. URL) so that @@ -1280,7 +1230,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class Event(EventBase): """Defines the event properties. - :ivar name: The name of the event. Required. :vartype name: str :ivar event_notifier: The address of the notifier of the event in the asset (e.g. URL) so that @@ -1325,10 +1274,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ExtendedLocation(_model_base.Model): +class ExtendedLocation(_Model): """The extended location. - :ivar type: The extended location type. Required. :vartype type: str :ivar name: The extended location name. Required. @@ -1359,12 +1307,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MessageSchemaReference(_model_base.Model): +class MessageSchemaReference(_Model): """Defines the message schema reference properties. - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar schema_registry_namespace: The message schema registry namespace. Required. :vartype schema_registry_namespace: str :ivar schema_name: The message schema name. Required. @@ -1381,10 +1326,8 @@ class MessageSchemaReference(_model_base.Model): """The message schema version. Required.""" -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". @@ -1440,11 +1383,9 @@ 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 @@ -1473,12 +1414,9 @@ class OperationDisplay(_model_base.Model): views.""" -class OperationStatusResult(_model_base.Model): +class OperationStatusResult(_Model): """The current status of an async operation. - Readonly variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified ID for the async operation. :vartype id: str :ivar name: Name of the async operation. @@ -1552,7 +1490,7 @@ 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. @@ -1619,10 +1557,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Topic(_model_base.Model): +class Topic(_Model): """Object that describes the topic information. - :ivar path: The topic path for messages published to an MQTT broker. Required. :vartype path: str :ivar retain: When set to 'Keep', messages published to an MQTT broker will have the retain @@ -1657,10 +1594,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class UsernamePasswordCredentials(_model_base.Model): +class UsernamePasswordCredentials(_Model): """The credentials for authentication mode UsernamePassword. - :ivar username_secret_name: The name of the secret containing the username. Required. :vartype username_secret_name: str :ivar password_secret_name: The name of the secret containing the password. Required. @@ -1695,10 +1631,9 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class X509Credentials(_model_base.Model): +class X509Credentials(_Model): """The x509 certificate for authentication mode Certificate. - :ivar certificate_secret_name: The name of the secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). Required. :vartype certificate_secret_name: str diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_patch.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/models/_patch.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/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/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_operations.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_operations.py index 2519b9c67207..c9362dc6c122 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_operations.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_operations.py @@ -6,9 +6,9 @@ # 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 @@ -34,17 +34,13 @@ from .. import models as _models from .._configuration import DeviceRegistryMgmtClientConfiguration -from .._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize -from .._serialization import Deserializer, Serializer +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._utils.serialization import Deserializer, Serializer from .._validation import api_version_validation -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -504,7 +500,7 @@ class Operations: :attr:`operations` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: DeviceRegistryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") @@ -512,9 +508,6 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """List the operations for the provider. @@ -574,7 +567,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) @@ -608,7 +601,7 @@ class OperationStatusOperations: :attr:`operation_status` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: DeviceRegistryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") @@ -616,9 +609,6 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.OperationStatusResult: """Returns the current status of an async operation. @@ -694,7 +684,7 @@ class AssetsOperations: :attr:`assets` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: DeviceRegistryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") @@ -702,9 +692,6 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def get(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> _models.Asset: """Get a Asset. @@ -770,9 +757,6 @@ def get(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> _mode return deserialized # type: ignore - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def _create_or_replace_initial( self, resource_group_name: str, asset_name: str, resource: Union[_models.Asset, JSON, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: @@ -927,9 +911,6 @@ def begin_create_or_replace( """ @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def begin_create_or_replace( self, resource_group_name: str, asset_name: str, resource: Union[_models.Asset, JSON, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Asset]: @@ -1000,9 +981,6 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def _update_initial( self, resource_group_name: str, @@ -1159,9 +1137,6 @@ def begin_update( """ @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def begin_update( self, resource_group_name: str, @@ -1236,9 +1211,6 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def _delete_initial(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -1295,9 +1267,6 @@ def _delete_initial(self, resource_group_name: str, asset_name: str, **kwargs: A return deserialized # type: ignore @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def begin_delete(self, resource_group_name: str, asset_name: str, **kwargs: Any) -> LROPoller[None]: """Delete a Asset. @@ -1355,9 +1324,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Asset"]: """List Asset resources by resource group. @@ -1422,7 +1388,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Asset], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Asset], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1446,9 +1412,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Asset"]: """List Asset resources by subscription ID. @@ -1509,7 +1472,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Asset], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Asset], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1543,7 +1506,7 @@ class AssetEndpointProfilesOperations: :attr:`asset_endpoint_profiles` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: DeviceRegistryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") @@ -1551,9 +1514,6 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def get( self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any ) -> _models.AssetEndpointProfile: @@ -1621,9 +1581,6 @@ def get( return deserialized # type: ignore - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def _create_or_replace_initial( self, resource_group_name: str, @@ -1782,9 +1739,6 @@ def begin_create_or_replace( """ @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def begin_create_or_replace( self, resource_group_name: str, @@ -1859,9 +1813,6 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def _update_initial( self, resource_group_name: str, @@ -2018,9 +1969,6 @@ def begin_update( """ @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def begin_update( self, resource_group_name: str, @@ -2096,9 +2044,6 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def _delete_initial( self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any ) -> Iterator[bytes]: @@ -2157,9 +2102,6 @@ def _delete_initial( return deserialized # type: ignore @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def begin_delete( self, resource_group_name: str, asset_endpoint_profile_name: str, **kwargs: Any ) -> LROPoller[None]: @@ -2219,9 +2161,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def list_by_resource_group( self, resource_group_name: str, **kwargs: Any ) -> Iterable["_models.AssetEndpointProfile"]: @@ -2288,7 +2227,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.AssetEndpointProfile], deserialized["value"]) + list_of_elem = _deserialize(List[_models.AssetEndpointProfile], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -2312,9 +2251,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - @api_version_validation( - params_added_on={"2024-09-01-preview": ["base_url"]}, - ) def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AssetEndpointProfile"]: """List AssetEndpointProfile resources by subscription ID. @@ -2375,7 +2311,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.AssetEndpointProfile], deserialized["value"]) + list_of_elem = _deserialize(List[_models.AssetEndpointProfile], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -2409,7 +2345,7 @@ class BillingContainersOperations: :attr:`billing_containers` attribute. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: DeviceRegistryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") @@ -2419,9 +2355,7 @@ def __init__(self, *args, **kwargs): @distributed_trace @api_version_validation( method_added_on="2024-09-01-preview", - params_added_on={ - "2024-09-01-preview": ["base_url", "api_version", "subscription_id", "billing_container_name", "accept"] - }, + params_added_on={"2024-09-01-preview": ["api_version", "subscription_id", "billing_container_name", "accept"]}, ) def get(self, billing_container_name: str, **kwargs: Any) -> _models.BillingContainer: """Get a BillingContainer. @@ -2487,7 +2421,7 @@ def get(self, billing_container_name: str, **kwargs: Any) -> _models.BillingCont @distributed_trace @api_version_validation( method_added_on="2024-09-01-preview", - params_added_on={"2024-09-01-preview": ["base_url", "api_version", "subscription_id", "accept"]}, + params_added_on={"2024-09-01-preview": ["api_version", "subscription_id", "accept"]}, ) def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.BillingContainer"]: """List BillingContainer resources by subscription ID. @@ -2549,7 +2483,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.BillingContainer], deserialized["value"]) + list_of_elem = _deserialize(List[_models.BillingContainer], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_patch.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/operations/_patch.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/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/deviceregistry/azure-mgmt-deviceregistry/sdk_packaging.toml b/sdk/deviceregistry/azure-mgmt-deviceregistry/sdk_packaging.toml index 4a9347e91c9c..3f02d2a0962e 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/sdk_packaging.toml +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/sdk_packaging.toml @@ -3,7 +3,7 @@ package_name = "azure-mgmt-deviceregistry" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Deviceregistry Management" package_doc_id = "" -is_stable = false +is_stable = true is_arm = true need_msrestazure = false need_azuremgmtcore = true diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/setup.py b/sdk/deviceregistry/azure-mgmt-deviceregistry/setup.py index 2ea6f92b7ed3..572cad282845 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/setup.py +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/setup.py @@ -53,7 +53,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -77,7 +76,7 @@ "isodate>=0.6.1", "typing-extensions>=4.6.0", "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.8", + python_requires=">=3.9", ) diff --git a/sdk/deviceregistry/azure-mgmt-deviceregistry/tsp-location.yaml b/sdk/deviceregistry/azure-mgmt-deviceregistry/tsp-location.yaml index 9f4e014c4d8d..d93a64f0d01f 100644 --- a/sdk/deviceregistry/azure-mgmt-deviceregistry/tsp-location.yaml +++ b/sdk/deviceregistry/azure-mgmt-deviceregistry/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/deviceregistry/DeviceRegistry.Management -commit: 812060f2268dc35ed8866bcbaf94aa767cf87c8d +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs additionalDirectories: