Skip to content

Commit ad343a1

Browse files
author
SDKAuto
committed
CodeGen from PR 34270 in Azure/azure-rest-api-specs
Merge c5c31b0506df39bc9e78f53a9678914719c1964d into a19648565889eaae019e531c15f3045d1244c7ce
1 parent 6c30600 commit ad343a1

File tree

20 files changed

+193
-367
lines changed

20 files changed

+193
-367
lines changed

sdk/deviceregistry/azure-mgmt-deviceregistry/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Deviceregistry Management Client Library.
4-
This package has been tested with Python 3.8+.
4+
This package has been tested with Python 3.9+.
55
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
66

77
## _Disclaimer_
@@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
1212

1313
### Prerequisites
1414

15-
- Python 3.8+ is required to use this package.
15+
- Python 3.9+ is required to use this package.
1616
- [Azure subscription](https://azure.microsoft.com/free/)
1717

1818
### Install the package
@@ -24,7 +24,7 @@ pip install azure-identity
2424

2525
### Authentication
2626

27-
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables.
27+
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables.
2828

2929
- `AZURE_CLIENT_ID` for Azure client ID.
3030
- `AZURE_TENANT_ID` for Azure tenant ID.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"commit": "812060f2268dc35ed8866bcbaf94aa767cf87c8d",
2+
"commit": "079f70d6f2b754db6b736e117196104efd2dd496",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"typespec_src": "specification/deviceregistry/DeviceRegistry.Management",
5-
"@azure-tools/typespec-python": "0.38.4"
5+
"@azure-tools/typespec-python": "0.44.2"
66
}

sdk/deviceregistry/azure-mgmt-deviceregistry/apiview-properties.json

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,37 @@
4646
"azure.mgmt.deviceregistry.models.EventObservabilityMode": "Microsoft.DeviceRegistry.EventObservabilityMode",
4747
"azure.mgmt.deviceregistry.models.ProvisioningState": "Microsoft.DeviceRegistry.ProvisioningState",
4848
"azure.mgmt.deviceregistry.models.AuthenticationMethod": "Microsoft.DeviceRegistry.AuthenticationMethod",
49-
"azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.operations.list": "Azure.ResourceManager.Operations.list",
50-
"azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.operation_status.get": "Microsoft.DeviceRegistry.OperationStatus.get",
51-
"azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.get": "Microsoft.DeviceRegistry.Assets.get",
52-
"azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.begin_create_or_replace": "Microsoft.DeviceRegistry.Assets.createOrReplace",
53-
"azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.begin_update": "Microsoft.DeviceRegistry.Assets.update",
54-
"azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.begin_delete": "Microsoft.DeviceRegistry.Assets.delete",
55-
"azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.list_by_resource_group": "Microsoft.DeviceRegistry.Assets.listByResourceGroup",
56-
"azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.assets.list_by_subscription": "Microsoft.DeviceRegistry.Assets.listBySubscription",
57-
"azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.get": "Microsoft.DeviceRegistry.AssetEndpointProfiles.get",
58-
"azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.begin_create_or_replace": "Microsoft.DeviceRegistry.AssetEndpointProfiles.createOrReplace",
59-
"azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.begin_update": "Microsoft.DeviceRegistry.AssetEndpointProfiles.update",
60-
"azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.begin_delete": "Microsoft.DeviceRegistry.AssetEndpointProfiles.delete",
61-
"azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.list_by_resource_group": "Microsoft.DeviceRegistry.AssetEndpointProfiles.listByResourceGroup",
62-
"azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.asset_endpoint_profiles.list_by_subscription": "Microsoft.DeviceRegistry.AssetEndpointProfiles.listBySubscription",
63-
"azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.billing_containers.get": "Microsoft.DeviceRegistry.BillingContainers.get",
64-
"azure.mgmt.deviceregistry.DeviceRegistryMgmtClient.billing_containers.list_by_subscription": "Microsoft.DeviceRegistry.BillingContainers.listBySubscription"
49+
"azure.mgmt.deviceregistry.operations.Operations.list": "Azure.ResourceManager.Operations.list",
50+
"azure.mgmt.deviceregistry.aio.operations.Operations.list": "Azure.ResourceManager.Operations.list",
51+
"azure.mgmt.deviceregistry.operations.OperationStatusOperations.get": "Microsoft.DeviceRegistry.OperationStatus.get",
52+
"azure.mgmt.deviceregistry.aio.operations.OperationStatusOperations.get": "Microsoft.DeviceRegistry.OperationStatus.get",
53+
"azure.mgmt.deviceregistry.operations.AssetsOperations.get": "Microsoft.DeviceRegistry.Assets.get",
54+
"azure.mgmt.deviceregistry.aio.operations.AssetsOperations.get": "Microsoft.DeviceRegistry.Assets.get",
55+
"azure.mgmt.deviceregistry.operations.AssetsOperations.begin_create_or_replace": "Microsoft.DeviceRegistry.Assets.createOrReplace",
56+
"azure.mgmt.deviceregistry.aio.operations.AssetsOperations.begin_create_or_replace": "Microsoft.DeviceRegistry.Assets.createOrReplace",
57+
"azure.mgmt.deviceregistry.operations.AssetsOperations.begin_update": "Microsoft.DeviceRegistry.Assets.update",
58+
"azure.mgmt.deviceregistry.aio.operations.AssetsOperations.begin_update": "Microsoft.DeviceRegistry.Assets.update",
59+
"azure.mgmt.deviceregistry.operations.AssetsOperations.begin_delete": "Microsoft.DeviceRegistry.Assets.delete",
60+
"azure.mgmt.deviceregistry.aio.operations.AssetsOperations.begin_delete": "Microsoft.DeviceRegistry.Assets.delete",
61+
"azure.mgmt.deviceregistry.operations.AssetsOperations.list_by_resource_group": "Microsoft.DeviceRegistry.Assets.listByResourceGroup",
62+
"azure.mgmt.deviceregistry.aio.operations.AssetsOperations.list_by_resource_group": "Microsoft.DeviceRegistry.Assets.listByResourceGroup",
63+
"azure.mgmt.deviceregistry.operations.AssetsOperations.list_by_subscription": "Microsoft.DeviceRegistry.Assets.listBySubscription",
64+
"azure.mgmt.deviceregistry.aio.operations.AssetsOperations.list_by_subscription": "Microsoft.DeviceRegistry.Assets.listBySubscription",
65+
"azure.mgmt.deviceregistry.operations.AssetEndpointProfilesOperations.get": "Microsoft.DeviceRegistry.AssetEndpointProfiles.get",
66+
"azure.mgmt.deviceregistry.aio.operations.AssetEndpointProfilesOperations.get": "Microsoft.DeviceRegistry.AssetEndpointProfiles.get",
67+
"azure.mgmt.deviceregistry.operations.AssetEndpointProfilesOperations.begin_create_or_replace": "Microsoft.DeviceRegistry.AssetEndpointProfiles.createOrReplace",
68+
"azure.mgmt.deviceregistry.aio.operations.AssetEndpointProfilesOperations.begin_create_or_replace": "Microsoft.DeviceRegistry.AssetEndpointProfiles.createOrReplace",
69+
"azure.mgmt.deviceregistry.operations.AssetEndpointProfilesOperations.begin_update": "Microsoft.DeviceRegistry.AssetEndpointProfiles.update",
70+
"azure.mgmt.deviceregistry.aio.operations.AssetEndpointProfilesOperations.begin_update": "Microsoft.DeviceRegistry.AssetEndpointProfiles.update",
71+
"azure.mgmt.deviceregistry.operations.AssetEndpointProfilesOperations.begin_delete": "Microsoft.DeviceRegistry.AssetEndpointProfiles.delete",
72+
"azure.mgmt.deviceregistry.aio.operations.AssetEndpointProfilesOperations.begin_delete": "Microsoft.DeviceRegistry.AssetEndpointProfiles.delete",
73+
"azure.mgmt.deviceregistry.operations.AssetEndpointProfilesOperations.list_by_resource_group": "Microsoft.DeviceRegistry.AssetEndpointProfiles.listByResourceGroup",
74+
"azure.mgmt.deviceregistry.aio.operations.AssetEndpointProfilesOperations.list_by_resource_group": "Microsoft.DeviceRegistry.AssetEndpointProfiles.listByResourceGroup",
75+
"azure.mgmt.deviceregistry.operations.AssetEndpointProfilesOperations.list_by_subscription": "Microsoft.DeviceRegistry.AssetEndpointProfiles.listBySubscription",
76+
"azure.mgmt.deviceregistry.aio.operations.AssetEndpointProfilesOperations.list_by_subscription": "Microsoft.DeviceRegistry.AssetEndpointProfiles.listBySubscription",
77+
"azure.mgmt.deviceregistry.operations.BillingContainersOperations.get": "Microsoft.DeviceRegistry.BillingContainers.get",
78+
"azure.mgmt.deviceregistry.aio.operations.BillingContainersOperations.get": "Microsoft.DeviceRegistry.BillingContainers.get",
79+
"azure.mgmt.deviceregistry.operations.BillingContainersOperations.list_by_subscription": "Microsoft.DeviceRegistry.BillingContainers.listBySubscription",
80+
"azure.mgmt.deviceregistry.aio.operations.BillingContainersOperations.list_by_subscription": "Microsoft.DeviceRegistry.BillingContainers.listBySubscription"
6581
}
6682
}

sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_client.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@
77
# --------------------------------------------------------------------------
88

99
from copy import deepcopy
10-
from typing import Any, TYPE_CHECKING
10+
from typing import Any, Optional, TYPE_CHECKING, cast
1111
from typing_extensions import Self
1212

1313
from azure.core.pipeline import policies
1414
from azure.core.rest import HttpRequest, HttpResponse
15+
from azure.core.settings import settings
1516
from azure.mgmt.core import ARMPipelineClient
1617
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
18+
from azure.mgmt.core.tools import get_arm_endpoints
1719

1820
from ._configuration import DeviceRegistryMgmtClientConfiguration
19-
from ._serialization import Deserializer, Serializer
21+
from ._utils.serialization import Deserializer, Serializer
2022
from .operations import (
2123
AssetEndpointProfilesOperations,
2224
AssetsOperations,
@@ -47,7 +49,7 @@ class DeviceRegistryMgmtClient:
4749
:type credential: ~azure.core.credentials.TokenCredential
4850
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
4951
:type subscription_id: str
50-
:param base_url: Service host. Default value is "https://management.azure.com".
52+
:param base_url: Service host. Default value is None.
5153
:type base_url: str
5254
:keyword api_version: The API version to use for this operation. Default value is "2024-11-01".
5355
Note that overriding this default value may result in unsupported behavior.
@@ -57,16 +59,22 @@ class DeviceRegistryMgmtClient:
5759
"""
5860

5961
def __init__(
60-
self,
61-
credential: "TokenCredential",
62-
subscription_id: str,
63-
base_url: str = "https://management.azure.com",
64-
**kwargs: Any
62+
self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any
6563
) -> None:
6664
_endpoint = "{endpoint}"
65+
_cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore
66+
_endpoints = get_arm_endpoints(_cloud)
67+
if not base_url:
68+
base_url = _endpoints["resource_manager"]
69+
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
6770
self._config = DeviceRegistryMgmtClientConfiguration(
68-
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
71+
credential=credential,
72+
subscription_id=subscription_id,
73+
base_url=cast(str, base_url),
74+
credential_scopes=credential_scopes,
75+
**kwargs
6976
)
77+
7078
_policies = kwargs.pop("policies", None)
7179
if _policies is None:
7280
_policies = [
@@ -85,7 +93,7 @@ def __init__(
8593
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
8694
self._config.http_logging_policy,
8795
]
88-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
96+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs)
8997

9098
self._serialize = Serializer()
9199
self._deserialize = Deserializer()

sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_patch.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# ------------------------------------
2-
# Copyright (c) Microsoft Corporation.
3-
# Licensed under the MIT License.
4-
# ------------------------------------
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# --------------------------------------------------------------------------
56
"""Customize generated code here.
67
78
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# --------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# Code generated by Microsoft (R) Python Code Generator.
5+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
6+
# --------------------------------------------------------------------------

sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_model_base.py renamed to sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_utils/model_base.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
# coding=utf-8
33
# --------------------------------------------------------------------------
44
# Copyright (c) Microsoft Corporation. All rights reserved.
5-
# Licensed under the MIT License. See License.txt in the project root for
6-
# license information.
5+
# Licensed under the MIT License. See License.txt in the project root for license information.
6+
# Code generated by Microsoft (R) Python Code Generator.
7+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
78
# --------------------------------------------------------------------------
89
# pylint: disable=protected-access, broad-except
910

@@ -21,18 +22,14 @@
2122
from datetime import datetime, date, time, timedelta, timezone
2223
from json import JSONEncoder
2324
import xml.etree.ElementTree as ET
25+
from collections.abc import MutableMapping
2426
from typing_extensions import Self
2527
import isodate
2628
from azure.core.exceptions import DeserializationError
2729
from azure.core import CaseInsensitiveEnumMeta
2830
from azure.core.pipeline import PipelineResponse
2931
from azure.core.serialization import _Null
3032

31-
if sys.version_info >= (3, 9):
32-
from collections.abc import MutableMapping
33-
else:
34-
from typing import MutableMapping
35-
3633
_LOGGER = logging.getLogger(__name__)
3734

3835
__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"]
@@ -347,7 +344,7 @@ def _get_model(module_name: str, model_name: str):
347344
_UNSET = object()
348345

349346

350-
class _MyMutableMapping(MutableMapping[str, typing.Any]): # pylint: disable=unsubscriptable-object
347+
class _MyMutableMapping(MutableMapping[str, typing.Any]):
351348
def __init__(self, data: typing.Dict[str, typing.Any]) -> None:
352349
self._data = data
353350

@@ -407,13 +404,13 @@ def get(self, key: str, default: typing.Any = None) -> typing.Any:
407404
return default
408405

409406
@typing.overload
410-
def pop(self, key: str) -> typing.Any: ...
407+
def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ
411408

412409
@typing.overload
413-
def pop(self, key: str, default: _T) -> _T: ...
410+
def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs
414411

415412
@typing.overload
416-
def pop(self, key: str, default: typing.Any) -> typing.Any: ...
413+
def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs
417414

418415
def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
419416
"""
@@ -443,7 +440,7 @@ def clear(self) -> None:
443440
"""
444441
self._data.clear()
445442

446-
def update(self, *args: typing.Any, **kwargs: typing.Any) -> None:
443+
def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ
447444
"""
448445
Updates D from mapping/iterable E and F.
449446
: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:
454451
def setdefault(self, key: str, default: None = None) -> None: ...
455452

456453
@typing.overload
457-
def setdefault(self, key: str, default: typing.Any) -> typing.Any: ...
454+
def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs
458455

459456
def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
460457
"""
@@ -644,7 +641,7 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self:
644641
cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items())
645642
cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}")
646643

647-
return super().__new__(cls) # pylint: disable=no-value-for-parameter
644+
return super().__new__(cls)
648645

649646
def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None:
650647
for base in cls.__bases__:
@@ -680,7 +677,7 @@ def _deserialize(cls, data, exist_discriminators):
680677
discriminator_value = data.find(xml_name).text # pyright: ignore
681678
else:
682679
discriminator_value = data.get(discriminator._rest_name)
683-
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore
680+
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member
684681
return mapped_cls._deserialize(data, exist_discriminators)
685682

686683
def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]:

sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_serialization.py renamed to sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_utils/serialization.py

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,10 @@
11
# pylint: disable=line-too-long,useless-suppression,too-many-lines
2+
# coding=utf-8
23
# --------------------------------------------------------------------------
3-
#
44
# Copyright (c) Microsoft Corporation. All rights reserved.
5-
#
6-
# The MIT License (MIT)
7-
#
8-
# Permission is hereby granted, free of charge, to any person obtaining a copy
9-
# of this software and associated documentation files (the ""Software""), to
10-
# deal in the Software without restriction, including without limitation the
11-
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12-
# sell copies of the Software, and to permit persons to whom the Software is
13-
# furnished to do so, subject to the following conditions:
14-
#
15-
# The above copyright notice and this permission notice shall be included in
16-
# all copies or substantial portions of the Software.
17-
#
18-
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23-
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24-
# IN THE SOFTWARE.
25-
#
5+
# Licensed under the MIT License. See License.txt in the project root for license information.
6+
# Code generated by Microsoft (R) Python Code Generator.
7+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
268
# --------------------------------------------------------------------------
279

2810
# pyright: reportUnnecessaryTypeIgnoreComment=false
@@ -411,7 +393,7 @@ def from_dict(
411393
:param function key_extractors: A key extractor function.
412394
:param str content_type: JSON by default, set application/xml if XML.
413395
:returns: An instance of this model
414-
:raises: DeserializationError if something went wrong
396+
:raises DeserializationError: if something went wrong
415397
:rtype: Self
416398
"""
417399
deserializer = Deserializer(cls._infer_class_models())

sdk/deviceregistry/azure-mgmt-deviceregistry/azure/mgmt/deviceregistry/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
VERSION = "1.0.0"
9+
VERSION = "1.0.0b1"

0 commit comments

Comments
 (0)