Skip to content

Commit 5eca695

Browse files
azure-sdkmsyyc
andauthored
[AutoPR azure-mgmt-resource]-generated-from-SDK Generation - Python-5801393 (#44863)
* Configurations: 'specification/resources/resource-manager/readme.md', API Version: 2025-11-01, SDK Release Type: beta, and CommitSHA: '07b9f3536b0cbcdbe18a4f7037af272b1df5bbc1' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' * Update CHANGELOG.md * update version --------- Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>
1 parent 2d975c3 commit 5eca695

File tree

95 files changed

+1552
-696
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1552
-696
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
recursive-include tests *.py *.json
2-
recursive-include samples *.py *.md
31
include *.md
4-
include azure/__init__.py
5-
include azure/mgmt/__init__.py
62
include LICENSE
73
include azure/mgmt/resource/py.typed
4+
recursive-include tests *.py
5+
recursive-include samples *.py *.md
6+
include azure/__init__.py
7+
include azure/mgmt/__init__.py

sdk/resources/azure-mgmt-resource/_metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"autorest": "3.10.2",
55
"use": [
6-
"@autorest/python@6.35.0",
6+
"@autorest/python@6.48.0",
77
"@autorest/modelerfour@4.27.0"
88
],
9-
"autorest_command": "autorest specification/resources/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.35.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
9+
"autorest_command": "autorest specification/resources/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --package-mode=azure-mgmt --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.48.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False",
1010
"readme": "specification/resources/resource-manager/readme.md"
1111
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"CrossLanguagePackageId": null,
3+
"CrossLanguageDefinitionId": {
4+
"azure.mgmt.resource.databoundaries.models.Resource": null,
5+
"azure.mgmt.resource.databoundaries.models.ProxyResource": null,
6+
"azure.mgmt.resource.databoundaries.models.DataBoundaryDefinition": null,
7+
"azure.mgmt.resource.databoundaries.models.DataBoundaryProperties": null,
8+
"azure.mgmt.resource.databoundaries.models.ErrorAdditionalInfo": null,
9+
"azure.mgmt.resource.databoundaries.models.ErrorDetail": null,
10+
"azure.mgmt.resource.databoundaries.models.ErrorResponse": null,
11+
"azure.mgmt.resource.databoundaries.models.SystemData": null,
12+
"azure.mgmt.resource.databoundaries.models.DefaultName": null,
13+
"azure.mgmt.resource.databoundaries.models.DataBoundary": null,
14+
"azure.mgmt.resource.databoundaries.models.ProvisioningState": null,
15+
"azure.mgmt.resource.databoundaries.models.CreatedByType": null,
16+
"azure.mgmt.resource.databoundaries.operations.DataBoundariesOperations.put": null,
17+
"azure.mgmt.resource.databoundaries.aio.operations.DataBoundariesOperations.put": null,
18+
"azure.mgmt.resource.databoundaries.operations.DataBoundariesOperations.get_tenant": null,
19+
"azure.mgmt.resource.databoundaries.aio.operations.DataBoundariesOperations.get_tenant": null,
20+
"azure.mgmt.resource.databoundaries.operations.DataBoundariesOperations.get_scope": null,
21+
"azure.mgmt.resource.databoundaries.aio.operations.DataBoundariesOperations.get_scope": null
22+
}
23+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore

sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_changes_client.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from .operations import ChangesOperations
2424

2525
if TYPE_CHECKING:
26+
from azure.core import AzureClouds
2627
from azure.core.credentials import TokenCredential
2728

2829

@@ -38,21 +39,34 @@ class ChangesClient:
3839
:type subscription_id: str
3940
:param base_url: Service URL. Default value is None.
4041
:type base_url: str
42+
:keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is
43+
None.
44+
:paramtype cloud_setting: ~azure.core.AzureClouds
4145
:keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this
4246
default value may result in unsupported behavior.
4347
:paramtype api_version: str
4448
"""
4549

4650
def __init__(
47-
self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any
51+
self,
52+
credential: "TokenCredential",
53+
subscription_id: str,
54+
base_url: Optional[str] = None,
55+
*,
56+
cloud_setting: Optional["AzureClouds"] = None,
57+
**kwargs: Any
4858
) -> None:
49-
_cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore
59+
_cloud = cloud_setting or settings.current.azure_cloud # type: ignore
5060
_endpoints = get_arm_endpoints(_cloud)
5161
if not base_url:
5262
base_url = _endpoints["resource_manager"]
5363
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
5464
self._config = ChangesClientConfiguration(
55-
credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs
65+
credential=credential,
66+
subscription_id=subscription_id,
67+
cloud_setting=cloud_setting,
68+
credential_scopes=credential_scopes,
69+
**kwargs
5670
)
5771

5872
_policies = kwargs.pop("policies", None)

sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_configuration.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import Any, TYPE_CHECKING
9+
from typing import Any, Optional, TYPE_CHECKING
1010

1111
from azure.core.pipeline import policies
1212
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1313

1414
from ._version import VERSION
1515

1616
if TYPE_CHECKING:
17+
from azure.core import AzureClouds
1718
from azure.core.credentials import TokenCredential
1819

1920

@@ -28,12 +29,21 @@ class ChangesClientConfiguration: # pylint: disable=too-many-instance-attribute
2829
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
2930
00000000-0000-0000-0000-000000000000). Required.
3031
:type subscription_id: str
32+
:param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is
33+
None.
34+
:type cloud_setting: ~azure.core.AzureClouds
3135
:keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this
3236
default value may result in unsupported behavior.
3337
:paramtype api_version: str
3438
"""
3539

36-
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
40+
def __init__(
41+
self,
42+
credential: "TokenCredential",
43+
subscription_id: str,
44+
cloud_setting: Optional["AzureClouds"] = None,
45+
**kwargs: Any
46+
) -> None:
3747
api_version: str = kwargs.pop("api_version", "2022-05-01")
3848

3949
if credential is None:
@@ -43,6 +53,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
4353

4454
self.credential = credential
4555
self.subscription_id = subscription_id
56+
self.cloud_setting = cloud_setting
4657
self.api_version = api_version
4758
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
4859
kwargs.setdefault("sdk_moniker", "mgmt-resource/{}".format(VERSION))

sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_utils/serialization.py

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import sys
2222
import codecs
2323
from typing import (
24-
Dict,
2524
Any,
2625
cast,
2726
Optional,
@@ -31,7 +30,6 @@
3130
Mapping,
3231
Callable,
3332
MutableMapping,
34-
List,
3533
)
3634

3735
try:
@@ -229,12 +227,12 @@ class Model:
229227
serialization and deserialization.
230228
"""
231229

232-
_subtype_map: Dict[str, Dict[str, Any]] = {}
233-
_attribute_map: Dict[str, Dict[str, Any]] = {}
234-
_validation: Dict[str, Dict[str, Any]] = {}
230+
_subtype_map: dict[str, dict[str, Any]] = {}
231+
_attribute_map: dict[str, dict[str, Any]] = {}
232+
_validation: dict[str, dict[str, Any]] = {}
235233

236234
def __init__(self, **kwargs: Any) -> None:
237-
self.additional_properties: Optional[Dict[str, Any]] = {}
235+
self.additional_properties: Optional[dict[str, Any]] = {}
238236
for k in kwargs: # pylint: disable=consider-using-dict-items
239237
if k not in self._attribute_map:
240238
_LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__)
@@ -311,7 +309,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON:
311309
def as_dict(
312310
self,
313311
keep_readonly: bool = True,
314-
key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer,
312+
key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer,
315313
**kwargs: Any
316314
) -> JSON:
317315
"""Return a dict that can be serialized using json.dump.
@@ -380,7 +378,7 @@ def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self:
380378
def from_dict(
381379
cls,
382380
data: Any,
383-
key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None,
381+
key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None,
384382
content_type: Optional[str] = None,
385383
) -> Self:
386384
"""Parse a dict using given key extractor return a model.
@@ -414,7 +412,7 @@ def _flatten_subtype(cls, key, objects):
414412
return {}
415413
result = dict(cls._subtype_map[key])
416414
for valuetype in cls._subtype_map[key].values():
417-
result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access
415+
result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access
418416
return result
419417

420418
@classmethod
@@ -528,7 +526,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None:
528526
"[]": self.serialize_iter,
529527
"{}": self.serialize_dict,
530528
}
531-
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
529+
self.dependencies: dict[str, type] = dict(classes) if classes else {}
532530
self.key_transformer = full_restapi_key_transformer
533531
self.client_side_validation = True
534532

@@ -579,7 +577,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to
579577

580578
if attr_name == "additional_properties" and attr_desc["key"] == "":
581579
if target_obj.additional_properties is not None:
582-
serialized.update(target_obj.additional_properties)
580+
serialized |= target_obj.additional_properties
583581
continue
584582
try:
585583

@@ -789,7 +787,7 @@ def serialize_data(self, data, data_type, **kwargs):
789787

790788
# If dependencies is empty, try with current data class
791789
# It has to be a subclass of Enum anyway
792-
enum_type = self.dependencies.get(data_type, data.__class__)
790+
enum_type = self.dependencies.get(data_type, cast(type, data.__class__))
793791
if issubclass(enum_type, Enum):
794792
return Serializer.serialize_enum(data, enum_obj=enum_type)
795793

@@ -823,13 +821,20 @@ def serialize_basic(cls, data, data_type, **kwargs):
823821
:param str data_type: Type of object in the iterable.
824822
:rtype: str, int, float, bool
825823
:return: serialized object
824+
:raises TypeError: raise if data_type is not one of str, int, float, bool.
826825
"""
827826
custom_serializer = cls._get_custom_serializers(data_type, **kwargs)
828827
if custom_serializer:
829828
return custom_serializer(data)
830829
if data_type == "str":
831830
return cls.serialize_unicode(data)
832-
return eval(data_type)(data) # nosec # pylint: disable=eval-used
831+
if data_type == "int":
832+
return int(data)
833+
if data_type == "float":
834+
return float(data)
835+
if data_type == "bool":
836+
return bool(data)
837+
raise TypeError("Unknown basic data type: {}".format(data_type))
833838

834839
@classmethod
835840
def serialize_unicode(cls, data):
@@ -1184,7 +1189,7 @@ def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argumen
11841189

11851190
while "." in key:
11861191
# Need the cast, as for some reasons "split" is typed as list[str | Any]
1187-
dict_keys = cast(List[str], _FLATTEN.split(key))
1192+
dict_keys = cast(list[str], _FLATTEN.split(key))
11881193
if len(dict_keys) == 1:
11891194
key = _decode_attribute_map_key(dict_keys[0])
11901195
break
@@ -1386,7 +1391,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None:
13861391
"duration": (isodate.Duration, datetime.timedelta),
13871392
"iso-8601": (datetime.datetime),
13881393
}
1389-
self.dependencies: Dict[str, type] = dict(classes) if classes else {}
1394+
self.dependencies: dict[str, type] = dict(classes) if classes else {}
13901395
self.key_extractors = [rest_key_extractor, xml_key_extractor]
13911396
# Additional properties only works if the "rest_key_extractor" is used to
13921397
# extract the keys. Making it to work whatever the key extractor is too much
@@ -1759,7 +1764,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return
17591764
:param str data_type: deserialization data type.
17601765
:return: Deserialized basic type.
17611766
:rtype: str, int, float or bool
1762-
:raises TypeError: if string format is not valid.
1767+
:raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool.
17631768
"""
17641769
# If we're here, data is supposed to be a basic type.
17651770
# If it's still an XML node, take the text
@@ -1785,7 +1790,11 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return
17851790

17861791
if data_type == "str":
17871792
return self.deserialize_unicode(attr)
1788-
return eval(data_type)(attr) # nosec # pylint: disable=eval-used
1793+
if data_type == "int":
1794+
return int(attr)
1795+
if data_type == "float":
1796+
return float(attr)
1797+
raise TypeError("Unknown basic data type: {}".format(data_type))
17891798

17901799
@staticmethod
17911800
def deserialize_unicode(data):

sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/aio/_changes_client.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from .operations import ChangesOperations
2424

2525
if TYPE_CHECKING:
26+
from azure.core import AzureClouds
2627
from azure.core.credentials_async import AsyncTokenCredential
2728

2829

@@ -38,21 +39,34 @@ class ChangesClient:
3839
:type subscription_id: str
3940
:param base_url: Service URL. Default value is None.
4041
:type base_url: str
42+
:keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is
43+
None.
44+
:paramtype cloud_setting: ~azure.core.AzureClouds
4145
:keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this
4246
default value may result in unsupported behavior.
4347
:paramtype api_version: str
4448
"""
4549

4650
def __init__(
47-
self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any
51+
self,
52+
credential: "AsyncTokenCredential",
53+
subscription_id: str,
54+
base_url: Optional[str] = None,
55+
*,
56+
cloud_setting: Optional["AzureClouds"] = None,
57+
**kwargs: Any
4858
) -> None:
49-
_cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore
59+
_cloud = cloud_setting or settings.current.azure_cloud # type: ignore
5060
_endpoints = get_arm_endpoints(_cloud)
5161
if not base_url:
5262
base_url = _endpoints["resource_manager"]
5363
credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"])
5464
self._config = ChangesClientConfiguration(
55-
credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs
65+
credential=credential,
66+
subscription_id=subscription_id,
67+
cloud_setting=cloud_setting,
68+
credential_scopes=credential_scopes,
69+
**kwargs
5670
)
5771

5872
_policies = kwargs.pop("policies", None)

sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/aio/_configuration.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import Any, TYPE_CHECKING
9+
from typing import Any, Optional, TYPE_CHECKING
1010

1111
from azure.core.pipeline import policies
1212
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
1313

1414
from .._version import VERSION
1515

1616
if TYPE_CHECKING:
17+
from azure.core import AzureClouds
1718
from azure.core.credentials_async import AsyncTokenCredential
1819

1920

@@ -28,12 +29,21 @@ class ChangesClientConfiguration: # pylint: disable=too-many-instance-attribute
2829
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g.
2930
00000000-0000-0000-0000-000000000000). Required.
3031
:type subscription_id: str
32+
:param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is
33+
None.
34+
:type cloud_setting: ~azure.core.AzureClouds
3135
:keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this
3236
default value may result in unsupported behavior.
3337
:paramtype api_version: str
3438
"""
3539

36-
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
40+
def __init__(
41+
self,
42+
credential: "AsyncTokenCredential",
43+
subscription_id: str,
44+
cloud_setting: Optional["AzureClouds"] = None,
45+
**kwargs: Any
46+
) -> None:
3747
api_version: str = kwargs.pop("api_version", "2022-05-01")
3848

3949
if credential is None:
@@ -43,6 +53,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k
4353

4454
self.credential = credential
4555
self.subscription_id = subscription_id
56+
self.cloud_setting = cloud_setting
4657
self.api_version = api_version
4758
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
4859
kwargs.setdefault("sdk_moniker", "mgmt-resource/{}".format(VERSION))

0 commit comments

Comments
 (0)