Skip to content

Commit a13c257

Browse files
author
SDKAuto
committed
CodeGen from PR 31874 in Azure/azure-rest-api-specs
Merge 198bea37f7a2bbc17c8d98df0b217bbb450613e3 into 58740206b853320974ef5e4864f7be8120b15a27
1 parent bd605d9 commit a13c257

File tree

99 files changed

+21460
-6116
lines changed

Some content is hidden

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

99 files changed

+21460
-6116
lines changed
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
2-
"commit": "1f6e89637068d59b5ae935de9a88d5742d12f8e6",
2+
"commit": "1eb05b957a92bd56ef0ae770335b5813338984c2",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.7",
5-
"use": [
6-
"@autorest/[email protected]",
7-
"@autorest/[email protected]"
8-
],
9-
"autorest_command": "autorest specification/deviceregistry/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.9.7 --version-tolerant=False",
10-
"readme": "specification/deviceregistry/resource-manager/readme.md"
4+
"typespec_src": "specification/deviceregistry/DeviceRegistry.Management",
5+
"@azure-tools/typespec-python": "0.37.1"
116
}

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,31 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._device_registry_mgmt_client import DeviceRegistryMgmtClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import DeviceRegistryMgmtClient # type: ignore
1016
from ._version import VERSION
1117

1218
__version__ = VERSION
1319

1420
try:
1521
from ._patch import __all__ as _patch_all
16-
from ._patch import * # pylint: disable=unused-wildcard-import
22+
from ._patch import *
1723
except ImportError:
1824
_patch_all = []
1925
from ._patch import patch_sdk as _patch_sdk
2026

2127
__all__ = [
2228
"DeviceRegistryMgmtClient",
2329
]
24-
__all__.extend([p for p in _patch_all if p not in __all__])
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2531

2632
_patch_sdk()
Lines changed: 67 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,72 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

99
from copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
11+
from typing_extensions import Self
1112

1213
from azure.core.pipeline import policies
1314
from azure.core.rest import HttpRequest, HttpResponse
1415
from azure.mgmt.core import ARMPipelineClient
1516
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1617

17-
from . import models as _models
1818
from ._configuration import DeviceRegistryMgmtClientConfiguration
1919
from ._serialization import Deserializer, Serializer
20-
from .operations import AssetEndpointProfilesOperations, AssetsOperations, OperationStatusOperations, Operations
20+
from .operations import (
21+
AssetEndpointProfilesOperations,
22+
AssetsOperations,
23+
BillingContainersOperations,
24+
DiscoveredAssetEndpointProfilesOperations,
25+
DiscoveredAssetsOperations,
26+
OperationStatusOperations,
27+
Operations,
28+
SchemaRegistriesOperations,
29+
SchemaVersionsOperations,
30+
SchemasOperations,
31+
)
2132

2233
if TYPE_CHECKING:
23-
# pylint: disable=unused-import,ungrouped-imports
2434
from azure.core.credentials import TokenCredential
2535

2636

27-
class DeviceRegistryMgmtClient: # pylint: disable=client-accepts-api-version-keyword
37+
class DeviceRegistryMgmtClient: # pylint: disable=too-many-instance-attributes
2838
"""Microsoft.DeviceRegistry Resource Provider management API.
2939
3040
:ivar operations: Operations operations
3141
:vartype operations: azure.mgmt.deviceregistry.operations.Operations
42+
:ivar operation_status: OperationStatusOperations operations
43+
:vartype operation_status: azure.mgmt.deviceregistry.operations.OperationStatusOperations
44+
:ivar assets: AssetsOperations operations
45+
:vartype assets: azure.mgmt.deviceregistry.operations.AssetsOperations
3246
:ivar asset_endpoint_profiles: AssetEndpointProfilesOperations operations
3347
:vartype asset_endpoint_profiles:
3448
azure.mgmt.deviceregistry.operations.AssetEndpointProfilesOperations
35-
:ivar assets: AssetsOperations operations
36-
:vartype assets: azure.mgmt.deviceregistry.operations.AssetsOperations
37-
:ivar operation_status: OperationStatusOperations operations
38-
:vartype operation_status: azure.mgmt.deviceregistry.operations.OperationStatusOperations
39-
:param credential: Credential needed for the client to connect to Azure. Required.
49+
:ivar billing_containers: BillingContainersOperations operations
50+
:vartype billing_containers: azure.mgmt.deviceregistry.operations.BillingContainersOperations
51+
:ivar discovered_assets: DiscoveredAssetsOperations operations
52+
:vartype discovered_assets: azure.mgmt.deviceregistry.operations.DiscoveredAssetsOperations
53+
:ivar discovered_asset_endpoint_profiles: DiscoveredAssetEndpointProfilesOperations operations
54+
:vartype discovered_asset_endpoint_profiles:
55+
azure.mgmt.deviceregistry.operations.DiscoveredAssetEndpointProfilesOperations
56+
:ivar schema_registries: SchemaRegistriesOperations operations
57+
:vartype schema_registries: azure.mgmt.deviceregistry.operations.SchemaRegistriesOperations
58+
:ivar schemas: SchemasOperations operations
59+
:vartype schemas: azure.mgmt.deviceregistry.operations.SchemasOperations
60+
:ivar schema_versions: SchemaVersionsOperations operations
61+
:vartype schema_versions: azure.mgmt.deviceregistry.operations.SchemaVersionsOperations
62+
:param credential: Credential used to authenticate requests to the service. Required.
4063
:type credential: ~azure.core.credentials.TokenCredential
41-
:param subscription_id: The ID of the target subscription. Required.
64+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
4265
:type subscription_id: str
43-
:param base_url: Service URL. Default value is "https://management.azure.com".
66+
:param base_url: Service host. Default value is "https://management.azure.com".
4467
:type base_url: str
45-
:keyword api_version: Api Version. Default value is "2023-11-01-preview". Note that overriding
46-
this default value may result in unsupported behavior.
68+
:keyword api_version: The API version to use for this operation. Default value is
69+
"2024-09-01-preview". Note that overriding this default value may result in unsupported
70+
behavior.
4771
:paramtype api_version: str
4872
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
4973
Retry-After header is present.
@@ -56,8 +80,9 @@ def __init__(
5680
base_url: str = "https://management.azure.com",
5781
**kwargs: Any
5882
) -> None:
83+
_endpoint = "{endpoint}"
5984
self._config = DeviceRegistryMgmtClientConfiguration(
60-
credential=credential, subscription_id=subscription_id, **kwargs
85+
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
6186
)
6287
_policies = kwargs.pop("policies", None)
6388
if _policies is None:
@@ -77,28 +102,41 @@ def __init__(
77102
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
78103
self._config.http_logging_policy,
79104
]
80-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
105+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
81106

82-
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
83-
self._serialize = Serializer(client_models)
84-
self._deserialize = Deserializer(client_models)
107+
self._serialize = Serializer()
108+
self._deserialize = Deserializer()
85109
self._serialize.client_side_validation = False
86110
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
87-
self.asset_endpoint_profiles = AssetEndpointProfilesOperations(
111+
self.operation_status = OperationStatusOperations(
88112
self._client, self._config, self._serialize, self._deserialize
89113
)
90114
self.assets = AssetsOperations(self._client, self._config, self._serialize, self._deserialize)
91-
self.operation_status = OperationStatusOperations(
115+
self.asset_endpoint_profiles = AssetEndpointProfilesOperations(
116+
self._client, self._config, self._serialize, self._deserialize
117+
)
118+
self.billing_containers = BillingContainersOperations(
119+
self._client, self._config, self._serialize, self._deserialize
120+
)
121+
self.discovered_assets = DiscoveredAssetsOperations(
92122
self._client, self._config, self._serialize, self._deserialize
93123
)
124+
self.discovered_asset_endpoint_profiles = DiscoveredAssetEndpointProfilesOperations(
125+
self._client, self._config, self._serialize, self._deserialize
126+
)
127+
self.schema_registries = SchemaRegistriesOperations(
128+
self._client, self._config, self._serialize, self._deserialize
129+
)
130+
self.schemas = SchemasOperations(self._client, self._config, self._serialize, self._deserialize)
131+
self.schema_versions = SchemaVersionsOperations(self._client, self._config, self._serialize, self._deserialize)
94132

95-
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
133+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
96134
"""Runs the network request through the client's chained policies.
97135
98136
>>> from azure.core.rest import HttpRequest
99137
>>> request = HttpRequest("GET", "https://www.example.org/")
100138
<HttpRequest [GET], url: 'https://www.example.org/'>
101-
>>> response = client._send_request(request)
139+
>>> response = client.send_request(request)
102140
<HttpResponse: 200 OK>
103141
104142
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -111,13 +149,17 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
111149
"""
112150

113151
request_copy = deepcopy(request)
114-
request_copy.url = self._client.format_url(request_copy.url)
152+
path_format_arguments = {
153+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
154+
}
155+
156+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
115157
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
116158

117159
def close(self) -> None:
118160
self._client.close()
119161

120-
def __enter__(self) -> "DeviceRegistryMgmtClient":
162+
def __enter__(self) -> Self:
121163
self._client.__enter__()
122164
return self
123165

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

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

@@ -14,27 +14,35 @@
1414
from ._version import VERSION
1515

1616
if TYPE_CHECKING:
17-
# pylint: disable=unused-import,ungrouped-imports
1817
from azure.core.credentials import TokenCredential
1918

2019

21-
class DeviceRegistryMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
20+
class DeviceRegistryMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes
2221
"""Configuration for DeviceRegistryMgmtClient.
2322
2423
Note that all parameters used to create this instance are saved as instance
2524
attributes.
2625
27-
:param credential: Credential needed for the client to connect to Azure. Required.
26+
:param credential: Credential used to authenticate requests to the service. Required.
2827
:type credential: ~azure.core.credentials.TokenCredential
29-
:param subscription_id: The ID of the target subscription. Required.
28+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3029
:type subscription_id: str
31-
:keyword api_version: Api Version. Default value is "2023-11-01-preview". Note that overriding
32-
this default value may result in unsupported behavior.
30+
:param base_url: Service host. Default value is "https://management.azure.com".
31+
:type base_url: str
32+
:keyword api_version: The API version to use for this operation. Default value is
33+
"2024-09-01-preview". Note that overriding this default value may result in unsupported
34+
behavior.
3335
:paramtype api_version: str
3436
"""
3537

36-
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
37-
api_version: str = kwargs.pop("api_version", "2023-11-01-preview")
38+
def __init__(
39+
self,
40+
credential: "TokenCredential",
41+
subscription_id: str,
42+
base_url: str = "https://management.azure.com",
43+
**kwargs: Any
44+
) -> None:
45+
api_version: str = kwargs.pop("api_version", "2024-09-01-preview")
3846

3947
if credential is None:
4048
raise ValueError("Parameter 'credential' must not be None.")
@@ -43,6 +51,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
4351

4452
self.credential = credential
4553
self.subscription_id = subscription_id
54+
self.base_url = base_url
4655
self.api_version = api_version
4756
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
4857
kwargs.setdefault("sdk_moniker", "mgmt-deviceregistry/{}".format(VERSION))

0 commit comments

Comments
 (0)