From e9f93deb81a37110bb8913dab953571903c4512b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 13 May 2025 08:34:10 +0000 Subject: [PATCH] CodeGen from PR 34633 in Azure/azure-rest-api-specs Merge 44f49c18a7d5618b7f8139c688ae3122c55b7473 into bd98c68b0a0b91e8479f7eb121d488f8f78d4d86 --- .../azure-mgmt-dependencymap/README.md | 6 +-- .../azure-mgmt-dependencymap/_meta.json | 4 +- .../apiview-properties.json | 48 +++++++++++------ .../azure/mgmt/dependencymap/_client.py | 28 ++++++---- .../azure/mgmt/dependencymap/_patch.py | 9 ++-- .../mgmt/dependencymap/_utils/__init__.py | 6 +++ .../{_model_base.py => _utils/model_base.py} | 27 +++++----- .../serialization.py} | 26 ++-------- .../azure/mgmt/dependencymap/aio/_client.py | 30 +++++++---- .../azure/mgmt/dependencymap/aio/_patch.py | 9 ++-- .../aio/operations/_operations.py | 12 ++--- .../dependencymap/aio/operations/_patch.py | 9 ++-- .../mgmt/dependencymap/models/_models.py | 51 +++++++++---------- .../azure/mgmt/dependencymap/models/_patch.py | 9 ++-- .../dependencymap/operations/_operations.py | 18 +++---- .../mgmt/dependencymap/operations/_patch.py | 9 ++-- .../azure-mgmt-dependencymap/setup.py | 5 +- .../tsp-location.yaml | 2 +- 18 files changed, 160 insertions(+), 148 deletions(-) create mode 100644 sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_utils/__init__.py rename sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/{_model_base.py => _utils/model_base.py} (98%) rename sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/{_serialization.py => _utils/serialization.py} (98%) diff --git a/sdk/dependencymap/azure-mgmt-dependencymap/README.md b/sdk/dependencymap/azure-mgmt-dependencymap/README.md index 345a4fdca685..69d8cb8a825b 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/README.md +++ b/sdk/dependencymap/azure-mgmt-dependencymap/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Dependencymap 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/dependencymap/azure-mgmt-dependencymap/_meta.json b/sdk/dependencymap/azure-mgmt-dependencymap/_meta.json index 49021f41748c..4196f30a0863 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/_meta.json +++ b/sdk/dependencymap/azure-mgmt-dependencymap/_meta.json @@ -1,6 +1,6 @@ { - "commit": "9e4890d02ec714b4b1465e1ca4767ae6bf5cb004", + "commit": "c8294111be770343690a652c4a6d381dce297712", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/azuredependencymap/DependencyMap.Management", - "@azure-tools/typespec-python": "0.40.0" + "@azure-tools/typespec-python": "0.44.2" } \ No newline at end of file diff --git a/sdk/dependencymap/azure-mgmt-dependencymap/apiview-properties.json b/sdk/dependencymap/azure-mgmt-dependencymap/apiview-properties.json index 18bae78eea45..6673380c87ea 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/apiview-properties.json +++ b/sdk/dependencymap/azure-mgmt-dependencymap/apiview-properties.json @@ -29,21 +29,37 @@ "azure.mgmt.dependencymap.models.ProvisioningState": "Microsoft.DependencyMap.ProvisioningState", "azure.mgmt.dependencymap.models.ProcessNameFilterOperator": "Microsoft.DependencyMap.ProcessNameFilterOperator", "azure.mgmt.dependencymap.models.SourceType": "Microsoft.DependencyMap.SourceType", - "azure.mgmt.dependencymap.DependencyMapMgmtClient.operations.list": "Azure.ResourceManager.Operations.list", - "azure.mgmt.dependencymap.DependencyMapMgmtClient.maps.get": "Microsoft.DependencyMap.Maps.get", - "azure.mgmt.dependencymap.DependencyMapMgmtClient.maps.begin_create_or_update": "Microsoft.DependencyMap.Maps.createOrUpdate", - "azure.mgmt.dependencymap.DependencyMapMgmtClient.maps.begin_update": "Microsoft.DependencyMap.Maps.update", - "azure.mgmt.dependencymap.DependencyMapMgmtClient.maps.begin_delete": "Microsoft.DependencyMap.Maps.delete", - "azure.mgmt.dependencymap.DependencyMapMgmtClient.maps.list_by_resource_group": "Microsoft.DependencyMap.Maps.listByResourceGroup", - "azure.mgmt.dependencymap.DependencyMapMgmtClient.maps.list_by_subscription": "Microsoft.DependencyMap.Maps.listBySubscription", - "azure.mgmt.dependencymap.DependencyMapMgmtClient.maps.begin_get_dependency_view_for_focused_machine": "Microsoft.DependencyMap.Maps.getDependencyViewForFocusedMachine", - "azure.mgmt.dependencymap.DependencyMapMgmtClient.maps.begin_get_connections_with_connected_machine_for_focused_machine": "Microsoft.DependencyMap.Maps.getConnectionsWithConnectedMachineForFocusedMachine", - "azure.mgmt.dependencymap.DependencyMapMgmtClient.maps.begin_get_connections_for_process_on_focused_machine": "Microsoft.DependencyMap.Maps.getConnectionsForProcessOnFocusedMachine", - "azure.mgmt.dependencymap.DependencyMapMgmtClient.maps.begin_export_dependencies": "Microsoft.DependencyMap.Maps.exportDependencies", - "azure.mgmt.dependencymap.DependencyMapMgmtClient.discovery_sources.get": "Microsoft.DependencyMap.DiscoverySources.get", - "azure.mgmt.dependencymap.DependencyMapMgmtClient.discovery_sources.begin_create_or_update": "Microsoft.DependencyMap.DiscoverySources.createOrUpdate", - "azure.mgmt.dependencymap.DependencyMapMgmtClient.discovery_sources.begin_update": "Microsoft.DependencyMap.DiscoverySources.update", - "azure.mgmt.dependencymap.DependencyMapMgmtClient.discovery_sources.begin_delete": "Microsoft.DependencyMap.DiscoverySources.delete", - "azure.mgmt.dependencymap.DependencyMapMgmtClient.discovery_sources.list_by_maps_resource": "Microsoft.DependencyMap.DiscoverySources.listByMapsResource" + "azure.mgmt.dependencymap.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.dependencymap.aio.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.dependencymap.operations.MapsOperations.get": "Microsoft.DependencyMap.Maps.get", + "azure.mgmt.dependencymap.aio.operations.MapsOperations.get": "Microsoft.DependencyMap.Maps.get", + "azure.mgmt.dependencymap.operations.MapsOperations.begin_create_or_update": "Microsoft.DependencyMap.Maps.createOrUpdate", + "azure.mgmt.dependencymap.aio.operations.MapsOperations.begin_create_or_update": "Microsoft.DependencyMap.Maps.createOrUpdate", + "azure.mgmt.dependencymap.operations.MapsOperations.begin_update": "Microsoft.DependencyMap.Maps.update", + "azure.mgmt.dependencymap.aio.operations.MapsOperations.begin_update": "Microsoft.DependencyMap.Maps.update", + "azure.mgmt.dependencymap.operations.MapsOperations.begin_delete": "Microsoft.DependencyMap.Maps.delete", + "azure.mgmt.dependencymap.aio.operations.MapsOperations.begin_delete": "Microsoft.DependencyMap.Maps.delete", + "azure.mgmt.dependencymap.operations.MapsOperations.list_by_resource_group": "Microsoft.DependencyMap.Maps.listByResourceGroup", + "azure.mgmt.dependencymap.aio.operations.MapsOperations.list_by_resource_group": "Microsoft.DependencyMap.Maps.listByResourceGroup", + "azure.mgmt.dependencymap.operations.MapsOperations.list_by_subscription": "Microsoft.DependencyMap.Maps.listBySubscription", + "azure.mgmt.dependencymap.aio.operations.MapsOperations.list_by_subscription": "Microsoft.DependencyMap.Maps.listBySubscription", + "azure.mgmt.dependencymap.operations.MapsOperations.begin_get_dependency_view_for_focused_machine": "Microsoft.DependencyMap.Maps.getDependencyViewForFocusedMachine", + "azure.mgmt.dependencymap.aio.operations.MapsOperations.begin_get_dependency_view_for_focused_machine": "Microsoft.DependencyMap.Maps.getDependencyViewForFocusedMachine", + "azure.mgmt.dependencymap.operations.MapsOperations.begin_get_connections_with_connected_machine_for_focused_machine": "Microsoft.DependencyMap.Maps.getConnectionsWithConnectedMachineForFocusedMachine", + "azure.mgmt.dependencymap.aio.operations.MapsOperations.begin_get_connections_with_connected_machine_for_focused_machine": "Microsoft.DependencyMap.Maps.getConnectionsWithConnectedMachineForFocusedMachine", + "azure.mgmt.dependencymap.operations.MapsOperations.begin_get_connections_for_process_on_focused_machine": "Microsoft.DependencyMap.Maps.getConnectionsForProcessOnFocusedMachine", + "azure.mgmt.dependencymap.aio.operations.MapsOperations.begin_get_connections_for_process_on_focused_machine": "Microsoft.DependencyMap.Maps.getConnectionsForProcessOnFocusedMachine", + "azure.mgmt.dependencymap.operations.MapsOperations.begin_export_dependencies": "Microsoft.DependencyMap.Maps.exportDependencies", + "azure.mgmt.dependencymap.aio.operations.MapsOperations.begin_export_dependencies": "Microsoft.DependencyMap.Maps.exportDependencies", + "azure.mgmt.dependencymap.operations.DiscoverySourcesOperations.get": "Microsoft.DependencyMap.DiscoverySources.get", + "azure.mgmt.dependencymap.aio.operations.DiscoverySourcesOperations.get": "Microsoft.DependencyMap.DiscoverySources.get", + "azure.mgmt.dependencymap.operations.DiscoverySourcesOperations.begin_create_or_update": "Microsoft.DependencyMap.DiscoverySources.createOrUpdate", + "azure.mgmt.dependencymap.aio.operations.DiscoverySourcesOperations.begin_create_or_update": "Microsoft.DependencyMap.DiscoverySources.createOrUpdate", + "azure.mgmt.dependencymap.operations.DiscoverySourcesOperations.begin_update": "Microsoft.DependencyMap.DiscoverySources.update", + "azure.mgmt.dependencymap.aio.operations.DiscoverySourcesOperations.begin_update": "Microsoft.DependencyMap.DiscoverySources.update", + "azure.mgmt.dependencymap.operations.DiscoverySourcesOperations.begin_delete": "Microsoft.DependencyMap.DiscoverySources.delete", + "azure.mgmt.dependencymap.aio.operations.DiscoverySourcesOperations.begin_delete": "Microsoft.DependencyMap.DiscoverySources.delete", + "azure.mgmt.dependencymap.operations.DiscoverySourcesOperations.list_by_maps_resource": "Microsoft.DependencyMap.DiscoverySources.listByMapsResource", + "azure.mgmt.dependencymap.aio.operations.DiscoverySourcesOperations.list_by_maps_resource": "Microsoft.DependencyMap.DiscoverySources.listByMapsResource" } } \ No newline at end of file diff --git a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_client.py b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_client.py index f8fb31fa38dd..e82e4231f897 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_client.py +++ b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_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 DependencyMapMgmtClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer from .operations import DiscoverySourcesOperations, MapsOperations, Operations if TYPE_CHECKING: @@ -36,7 +38,7 @@ class DependencyMapMgmtClient: :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 "2025-01-31-preview". Note that overriding this default value may result in unsupported @@ -47,16 +49,22 @@ class DependencyMapMgmtClient: """ 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 = DependencyMapMgmtClientConfiguration( - 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 = [ @@ -75,7 +83,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/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_patch.py b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_patch.py +++ b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_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/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_utils/__init__.py b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_utils/__init__.py new file mode 100644 index 000000000000..8026245c2abc --- /dev/null +++ b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_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/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_model_base.py b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_utils/model_base.py similarity index 98% rename from sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_model_base.py rename to sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_utils/model_base.py index 3072ee252ed9..49d5c7259389 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_model_base.py +++ b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_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/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_serialization.py b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_utils/serialization.py similarity index 98% rename from sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_serialization.py rename to sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_utils/serialization.py index 7a0232de5ddc..eb86ea23c965 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_serialization.py +++ b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/_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 diff --git a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/aio/_client.py b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/aio/_client.py index cc8c73635b3c..a86a910f4241 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/aio/_client.py +++ b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/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 DependencyMapMgmtClientConfiguration from .operations import DiscoverySourcesOperations, MapsOperations, Operations @@ -36,7 +38,7 @@ class DependencyMapMgmtClient: :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 "2025-01-31-preview". Note that overriding this default value may result in unsupported @@ -47,16 +49,22 @@ class DependencyMapMgmtClient: """ 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 = DependencyMapMgmtClientConfiguration( - 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 = [ @@ -75,7 +83,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/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/aio/_patch.py b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/aio/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/aio/_patch.py +++ b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/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/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/aio/operations/_operations.py b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/aio/operations/_operations.py index 5cd9a7e753e7..08e8eae47eae 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/aio/operations/_operations.py +++ b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/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 ...operations._operations import ( build_discovery_sources_create_or_update_request, build_discovery_sources_delete_request, @@ -56,13 +56,9 @@ ) from .._configuration import DependencyMapMgmtClientConfiguration -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: diff --git a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/aio/operations/_patch.py b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/aio/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/aio/operations/_patch.py +++ b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/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/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/models/_models.py b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/models/_models.py index 5f6f4b9b0f87..ba97d54cdeb5 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/models/_models.py +++ b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/models/_models.py @@ -11,15 +11,14 @@ import datetime from typing import Any, Dict, List, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload -from .. import _model_base -from .._model_base import rest_discriminator, rest_field +from .._utils.model_base import Model as _Model, rest_discriminator, rest_field from ._enums import SourceType if TYPE_CHECKING: from .. import models as _models -class DateTimeFilter(_model_base.Model): +class DateTimeFilter(_Model): """UTC DateTime filter for dependency map visualization apis. :ivar start_date_time_utc: Start date time for dependency map visualization query. @@ -56,7 +55,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DependencyMapVisualizationFilter(_model_base.Model): +class DependencyMapVisualizationFilter(_Model): """Filters for dependency map visualization apis. :ivar date_time: DateTime filter. @@ -93,8 +92,8 @@ 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. +class Resource(_Model): + """Resource. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -122,8 +121,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'. + """Tracked Resource. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. @@ -213,7 +211,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DiscoverySourceResourceProperties(_model_base.Model): +class DiscoverySourceResourceProperties(_Model): """The properties of Discovery Source resource. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -228,7 +226,7 @@ class DiscoverySourceResourceProperties(_model_base.Model): :vartype source_id: str """ - __mapping__: Dict[str, _model_base.Model] = {} + __mapping__: Dict[str, _Model] = {} provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( name="provisioningState", visibility=["read"] ) @@ -258,7 +256,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DiscoverySourceResourceTagsUpdate(_model_base.Model): +class DiscoverySourceResourceTagsUpdate(_Model): """The type used for updating tags in DiscoverySourceResource resources. :ivar tags: Resource tags. @@ -286,7 +284,7 @@ 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. :ivar type: The additional info type. @@ -301,7 +299,7 @@ class ErrorAdditionalInfo(_model_base.Model): """The additional info.""" -class ErrorDetail(_model_base.Model): +class ErrorDetail(_Model): """The error detail. :ivar code: The error code. @@ -330,9 +328,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.dependencymap.models.ErrorDetail @@ -359,7 +356,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ExportDependenciesRequest(_model_base.Model): +class ExportDependenciesRequest(_Model): """ExportDependencies request model. :ivar focused_machine_id: Machine arm id. Required. @@ -396,7 +393,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GetConnectionsForProcessOnFocusedMachineRequest(_model_base.Model): # pylint: disable=name-too-long +class GetConnectionsForProcessOnFocusedMachineRequest(_Model): # pylint: disable=name-too-long """GetConnectionsForProcessOnFocusedMachine request model. :ivar focused_machine_id: Machine arm id. Required. @@ -440,7 +437,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GetConnectionsWithConnectedMachineForFocusedMachineRequest(_model_base.Model): # pylint: disable=name-too-long +class GetConnectionsWithConnectedMachineForFocusedMachineRequest(_Model): # pylint: disable=name-too-long """GetConnectionsWithConnectedMachineForFocusedMachine request model. :ivar focused_machine_id: Source machine arm id. Required. @@ -484,7 +481,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class GetDependencyViewForFocusedMachineRequest(_model_base.Model): # pylint: disable=name-too-long +class GetDependencyViewForFocusedMachineRequest(_Model): # pylint: disable=name-too-long """GetDependencyViewForFocusedMachine request model. :ivar focused_machine_id: Machine arm id. Required. @@ -568,7 +565,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MapsResourceProperties(_model_base.Model): +class MapsResourceProperties(_Model): """The properties of Maps resource. :ivar provisioning_state: Provisioning state of Maps resource. Known values are: "Succeeded", @@ -583,7 +580,7 @@ class MapsResourceProperties(_model_base.Model): \"Provisioning\", \"Updating\", \"Deleting\", and \"Accepted\".""" -class MapsResourceTagsUpdate(_model_base.Model): +class MapsResourceTagsUpdate(_Model): """The type used for updating tags in MapsResource resources. :ivar tags: Resource tags. @@ -646,8 +643,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, source_type=SourceType.OFF_AZURE, **kwargs) -class Operation(_model_base.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. +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". @@ -703,7 +700,7 @@ 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. :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft @@ -734,7 +731,7 @@ class OperationDisplay(_model_base.Model): views.""" -class ProcessNameFilter(_model_base.Model): +class ProcessNameFilter(_Model): """Process name filter for dependency map visualization apis. :ivar operator: Operator for process name filter. Required. Known values are: "contains" and @@ -772,7 +769,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. diff --git a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/models/_patch.py b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/models/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/models/_patch.py +++ b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/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/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/operations/_operations.py b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/operations/_operations.py index b4db331c9f29..af35089d41be 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/operations/_operations.py +++ b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/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,16 +34,12 @@ from .. import models as _models from .._configuration import DependencyMapMgmtClientConfiguration -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 -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 @@ -519,7 +515,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: DependencyMapMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") @@ -620,7 +616,7 @@ class MapsOperations: :attr:`maps` 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: DependencyMapMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") @@ -2335,7 +2331,7 @@ class DiscoverySourcesOperations: :attr:`discovery_sources` 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: DependencyMapMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") diff --git a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/operations/_patch.py b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/operations/_patch.py +++ b/sdk/dependencymap/azure-mgmt-dependencymap/azure/mgmt/dependencymap/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/dependencymap/azure-mgmt-dependencymap/setup.py b/sdk/dependencymap/azure-mgmt-dependencymap/setup.py index 4aad6d4ca6ba..efb2a3ac837b 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/setup.py +++ b/sdk/dependencymap/azure-mgmt-dependencymap/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/dependencymap/azure-mgmt-dependencymap/tsp-location.yaml b/sdk/dependencymap/azure-mgmt-dependencymap/tsp-location.yaml index 2bdb411fe527..27f501953343 100644 --- a/sdk/dependencymap/azure-mgmt-dependencymap/tsp-location.yaml +++ b/sdk/dependencymap/azure-mgmt-dependencymap/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/azuredependencymap/DependencyMap.Management -commit: 9e4890d02ec714b4b1465e1ca4767ae6bf5cb004 +commit: c8294111be770343690a652c4a6d381dce297712 repo: Azure/azure-rest-api-specs additionalDirectories: