Skip to content

Commit 6b8a54a

Browse files
author
SDKAuto
committed
CodeGen from PR 33348 in Azure/azure-rest-api-specs
Merge e8a5688659580426014c61677819ac0bc88d0793 into bc79b816272c7e12d79e8bc63d689327fc37d11f
1 parent 7656cf2 commit 6b8a54a

File tree

93 files changed

+20363
-16562
lines changed

Some content is hidden

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

93 files changed

+20363
-16562
lines changed
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
2-
"commit": "09c37754dac91874ff689ed1e60effb4268c8669",
2+
"commit": "a2bd6a405683c01ba4bf92b47380d20e2306d991",
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/sphere/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/sphere/resource-manager/readme.md"
4+
"typespec_src": "specification/sphere/Sphere.Management",
5+
"@azure-tools/typespec-python": "0.40.0"
116
}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"CrossLanguagePackageId": "Microsoft.AzureSphere",
3+
"CrossLanguageDefinitionId": {
4+
"azure.mgmt.sphere.models.Resource": "Azure.ResourceManager.CommonTypes.Resource",
5+
"azure.mgmt.sphere.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource",
6+
"azure.mgmt.sphere.models.Catalog": "Microsoft.AzureSphere.Catalog",
7+
"azure.mgmt.sphere.models.CatalogProperties": "Microsoft.AzureSphere.CatalogProperties",
8+
"azure.mgmt.sphere.models.CatalogUpdate": "Microsoft.AzureSphere.CatalogUpdate",
9+
"azure.mgmt.sphere.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource",
10+
"azure.mgmt.sphere.models.Certificate": "Microsoft.AzureSphere.Certificate",
11+
"azure.mgmt.sphere.models.CertificateChainResponse": "Microsoft.AzureSphere.CertificateChainResponse",
12+
"azure.mgmt.sphere.models.CertificateProperties": "Microsoft.AzureSphere.CertificateProperties",
13+
"azure.mgmt.sphere.models.ClaimDevicesRequest": "Microsoft.AzureSphere.ClaimDevicesRequest",
14+
"azure.mgmt.sphere.models.CountElementsResponse": "Microsoft.AzureSphere.CountElementsResponse",
15+
"azure.mgmt.sphere.models.CountDevicesResponse": "Microsoft.AzureSphere.CountDevicesResponse",
16+
"azure.mgmt.sphere.models.Deployment": "Microsoft.AzureSphere.Deployment",
17+
"azure.mgmt.sphere.models.DeploymentProperties": "Microsoft.AzureSphere.DeploymentProperties",
18+
"azure.mgmt.sphere.models.Device": "Microsoft.AzureSphere.Device",
19+
"azure.mgmt.sphere.models.DeviceGroup": "Microsoft.AzureSphere.DeviceGroup",
20+
"azure.mgmt.sphere.models.DeviceGroupProperties": "Microsoft.AzureSphere.DeviceGroupProperties",
21+
"azure.mgmt.sphere.models.DeviceGroupUpdate": "Microsoft.AzureSphere.DeviceGroupUpdate",
22+
"azure.mgmt.sphere.models.DeviceGroupUpdateProperties": "Microsoft.AzureSphere.DeviceGroupUpdateProperties",
23+
"azure.mgmt.sphere.models.DeviceInsight": "Microsoft.AzureSphere.DeviceInsight",
24+
"azure.mgmt.sphere.models.DeviceProperties": "Microsoft.AzureSphere.DeviceProperties",
25+
"azure.mgmt.sphere.models.DeviceUpdate": "Microsoft.AzureSphere.DeviceUpdate",
26+
"azure.mgmt.sphere.models.DeviceUpdateProperties": "Microsoft.AzureSphere.DeviceUpdateProperties",
27+
"azure.mgmt.sphere.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo",
28+
"azure.mgmt.sphere.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail",
29+
"azure.mgmt.sphere.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse",
30+
"azure.mgmt.sphere.models.GenerateCapabilityImageRequest": "Microsoft.AzureSphere.GenerateCapabilityImageRequest",
31+
"azure.mgmt.sphere.models.Image": "Microsoft.AzureSphere.Image",
32+
"azure.mgmt.sphere.models.ImageProperties": "Microsoft.AzureSphere.ImageProperties",
33+
"azure.mgmt.sphere.models.ListDeviceGroupsRequest": "Microsoft.AzureSphere.ListDeviceGroupsRequest",
34+
"azure.mgmt.sphere.models.Operation": "Azure.ResourceManager.CommonTypes.Operation",
35+
"azure.mgmt.sphere.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay",
36+
"azure.mgmt.sphere.models.Product": "Microsoft.AzureSphere.Product",
37+
"azure.mgmt.sphere.models.ProductProperties": "Microsoft.AzureSphere.ProductProperties",
38+
"azure.mgmt.sphere.models.ProductUpdate": "Microsoft.AzureSphere.ProductUpdate",
39+
"azure.mgmt.sphere.models.ProductUpdateProperties": "Microsoft.AzureSphere.ProductUpdateProperties",
40+
"azure.mgmt.sphere.models.ProofOfPossessionNonceRequest": "Microsoft.AzureSphere.ProofOfPossessionNonceRequest",
41+
"azure.mgmt.sphere.models.ProofOfPossessionNonceResponse": "Microsoft.AzureSphere.ProofOfPossessionNonceResponse",
42+
"azure.mgmt.sphere.models.SignedCapabilityImageResponse": "Microsoft.AzureSphere.SignedCapabilityImageResponse",
43+
"azure.mgmt.sphere.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData",
44+
"azure.mgmt.sphere.models.Origin": "Azure.ResourceManager.CommonTypes.Origin",
45+
"azure.mgmt.sphere.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType",
46+
"azure.mgmt.sphere.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType",
47+
"azure.mgmt.sphere.models.ProvisioningState": "Microsoft.AzureSphere.ProvisioningState",
48+
"azure.mgmt.sphere.models.RegionalDataBoundary": "Microsoft.AzureSphere.RegionalDataBoundary",
49+
"azure.mgmt.sphere.models.ImageType": "Microsoft.AzureSphere.ImageType",
50+
"azure.mgmt.sphere.models.OSFeedType": "Microsoft.AzureSphere.OSFeedType",
51+
"azure.mgmt.sphere.models.UpdatePolicy": "Microsoft.AzureSphere.UpdatePolicy",
52+
"azure.mgmt.sphere.models.AllowCrashDumpCollection": "Microsoft.AzureSphere.AllowCrashDumpCollection",
53+
"azure.mgmt.sphere.models.CertificateStatus": "Microsoft.AzureSphere.CertificateStatus",
54+
"azure.mgmt.sphere.models.CapabilityType": "Microsoft.AzureSphere.CapabilityType",
55+
"azure.mgmt.sphere.AzureSphereMgmtClient.operations.list": "Azure.ResourceManager.Operations.list",
56+
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.get": "Microsoft.AzureSphere.Catalogs.get",
57+
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.begin_create_or_update": "Microsoft.AzureSphere.Catalogs.createOrUpdate",
58+
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.update": "Microsoft.AzureSphere.Catalogs.update",
59+
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.begin_delete": "Microsoft.AzureSphere.Catalogs.delete",
60+
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.list_by_resource_group": "Microsoft.AzureSphere.Catalogs.listByResourceGroup",
61+
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.list_by_subscription": "Microsoft.AzureSphere.Catalogs.listBySubscription",
62+
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.count_devices": "Microsoft.AzureSphere.Catalogs.countDevices",
63+
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.list_deployments": "Microsoft.AzureSphere.Catalogs.listDeployments",
64+
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.list_device_groups": "Microsoft.AzureSphere.Catalogs.listDeviceGroups",
65+
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.list_device_insights": "Microsoft.AzureSphere.Catalogs.listDeviceInsights",
66+
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.list_devices": "Microsoft.AzureSphere.Catalogs.listDevices",
67+
"azure.mgmt.sphere.AzureSphereMgmtClient.catalogs.begin_upload_image": "Microsoft.AzureSphere.Catalogs.uploadImage",
68+
"azure.mgmt.sphere.AzureSphereMgmtClient.certificates.get": "Microsoft.AzureSphere.Certificates.get",
69+
"azure.mgmt.sphere.AzureSphereMgmtClient.certificates.list_by_catalog": "Microsoft.AzureSphere.Certificates.listByCatalog",
70+
"azure.mgmt.sphere.AzureSphereMgmtClient.certificates.retrieve_cert_chain": "Microsoft.AzureSphere.Certificates.retrieveCertChain",
71+
"azure.mgmt.sphere.AzureSphereMgmtClient.certificates.retrieve_proof_of_possession_nonce": "Microsoft.AzureSphere.Certificates.retrieveProofOfPossessionNonce",
72+
"azure.mgmt.sphere.AzureSphereMgmtClient.images.get": "Microsoft.AzureSphere.Images.get",
73+
"azure.mgmt.sphere.AzureSphereMgmtClient.images.begin_create_or_update": "Microsoft.AzureSphere.Images.createOrUpdate",
74+
"azure.mgmt.sphere.AzureSphereMgmtClient.images.begin_delete": "Microsoft.AzureSphere.Images.delete",
75+
"azure.mgmt.sphere.AzureSphereMgmtClient.images.list_by_catalog": "Microsoft.AzureSphere.Images.listByCatalog",
76+
"azure.mgmt.sphere.AzureSphereMgmtClient.products.get": "Microsoft.AzureSphere.Products.get",
77+
"azure.mgmt.sphere.AzureSphereMgmtClient.products.begin_create_or_update": "Microsoft.AzureSphere.Products.createOrUpdate",
78+
"azure.mgmt.sphere.AzureSphereMgmtClient.products.begin_update": "Microsoft.AzureSphere.Products.update",
79+
"azure.mgmt.sphere.AzureSphereMgmtClient.products.begin_delete": "Microsoft.AzureSphere.Products.delete",
80+
"azure.mgmt.sphere.AzureSphereMgmtClient.products.list_by_catalog": "Microsoft.AzureSphere.Products.listByCatalog",
81+
"azure.mgmt.sphere.AzureSphereMgmtClient.products.count_devices": "Microsoft.AzureSphere.Products.countDevices",
82+
"azure.mgmt.sphere.AzureSphereMgmtClient.products.generate_default_device_groups": "Microsoft.AzureSphere.Products.generateDefaultDeviceGroups",
83+
"azure.mgmt.sphere.AzureSphereMgmtClient.device_groups.get": "Microsoft.AzureSphere.DeviceGroups.get",
84+
"azure.mgmt.sphere.AzureSphereMgmtClient.device_groups.begin_create_or_update": "Microsoft.AzureSphere.DeviceGroups.createOrUpdate",
85+
"azure.mgmt.sphere.AzureSphereMgmtClient.device_groups.begin_update": "Microsoft.AzureSphere.DeviceGroups.update",
86+
"azure.mgmt.sphere.AzureSphereMgmtClient.device_groups.begin_delete": "Microsoft.AzureSphere.DeviceGroups.delete",
87+
"azure.mgmt.sphere.AzureSphereMgmtClient.device_groups.list_by_product": "Microsoft.AzureSphere.DeviceGroups.listByProduct",
88+
"azure.mgmt.sphere.AzureSphereMgmtClient.device_groups.begin_claim_devices": "Microsoft.AzureSphere.DeviceGroups.claimDevices",
89+
"azure.mgmt.sphere.AzureSphereMgmtClient.device_groups.count_devices": "Microsoft.AzureSphere.DeviceGroups.countDevices",
90+
"azure.mgmt.sphere.AzureSphereMgmtClient.deployments.get": "Microsoft.AzureSphere.Deployments.get",
91+
"azure.mgmt.sphere.AzureSphereMgmtClient.deployments.begin_create_or_update": "Microsoft.AzureSphere.Deployments.createOrUpdate",
92+
"azure.mgmt.sphere.AzureSphereMgmtClient.deployments.begin_delete": "Microsoft.AzureSphere.Deployments.delete",
93+
"azure.mgmt.sphere.AzureSphereMgmtClient.deployments.list_by_device_group": "Microsoft.AzureSphere.Deployments.listByDeviceGroup",
94+
"azure.mgmt.sphere.AzureSphereMgmtClient.devices.get": "Microsoft.AzureSphere.Devices.get",
95+
"azure.mgmt.sphere.AzureSphereMgmtClient.devices.begin_create_or_update": "Microsoft.AzureSphere.Devices.createOrUpdate",
96+
"azure.mgmt.sphere.AzureSphereMgmtClient.devices.begin_update": "Microsoft.AzureSphere.Devices.update",
97+
"azure.mgmt.sphere.AzureSphereMgmtClient.devices.begin_delete": "Microsoft.AzureSphere.Devices.delete",
98+
"azure.mgmt.sphere.AzureSphereMgmtClient.devices.list_by_device_group": "Microsoft.AzureSphere.Devices.listByDeviceGroup",
99+
"azure.mgmt.sphere.AzureSphereMgmtClient.devices.begin_generate_capability_image": "Microsoft.AzureSphere.Devices.generateCapabilityImage"
100+
}
101+
}

sdk/sphere/azure-mgmt-sphere/azure/mgmt/sphere/__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 ._azure_sphere_mgmt_client import AzureSphereMgmtClient
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 AzureSphereMgmtClient # 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
"AzureSphereMgmtClient",
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: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
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 AzureSphereMgmtClientConfiguration
1919
from ._serialization import Deserializer, Serializer
2020
from .operations import (
@@ -29,11 +29,10 @@
2929
)
3030

3131
if TYPE_CHECKING:
32-
# pylint: disable=unused-import,ungrouped-imports
3332
from azure.core.credentials import TokenCredential
3433

3534

36-
class AzureSphereMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
35+
class AzureSphereMgmtClient: # pylint: disable=too-many-instance-attributes
3736
"""Azure Sphere resource management API.
3837
3938
:ivar operations: Operations operations
@@ -52,14 +51,14 @@ class AzureSphereMgmtClient: # pylint: disable=client-accepts-api-version-keywo
5251
:vartype deployments: azure.mgmt.sphere.operations.DeploymentsOperations
5352
:ivar devices: DevicesOperations operations
5453
:vartype devices: azure.mgmt.sphere.operations.DevicesOperations
55-
:param credential: Credential needed for the client to connect to Azure. Required.
54+
:param credential: Credential used to authenticate requests to the service. Required.
5655
:type credential: ~azure.core.credentials.TokenCredential
57-
:param subscription_id: The ID of the target subscription. Required.
56+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
5857
:type subscription_id: str
59-
:param base_url: Service URL. Default value is "https://management.azure.com".
58+
:param base_url: Service host. Default value is "https://management.azure.com".
6059
:type base_url: str
61-
:keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this
62-
default value may result in unsupported behavior.
60+
:keyword api_version: The API version to use for this operation. Default value is "2024-04-01".
61+
Note that overriding this default value may result in unsupported behavior.
6362
:paramtype api_version: str
6463
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
6564
Retry-After header is present.
@@ -72,8 +71,9 @@ def __init__(
7271
base_url: str = "https://management.azure.com",
7372
**kwargs: Any
7473
) -> None:
74+
_endpoint = "{endpoint}"
7575
self._config = AzureSphereMgmtClientConfiguration(
76-
credential=credential, subscription_id=subscription_id, **kwargs
76+
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
7777
)
7878
_policies = kwargs.pop("policies", None)
7979
if _policies is None:
@@ -93,11 +93,10 @@ def __init__(
9393
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
9494
self._config.http_logging_policy,
9595
]
96-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs)
96+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
9797

98-
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
99-
self._serialize = Serializer(client_models)
100-
self._deserialize = Deserializer(client_models)
98+
self._serialize = Serializer()
99+
self._deserialize = Deserializer()
101100
self._serialize.client_side_validation = False
102101
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
103102
self.catalogs = CatalogsOperations(self._client, self._config, self._serialize, self._deserialize)
@@ -108,13 +107,13 @@ def __init__(
108107
self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize)
109108
self.devices = DevicesOperations(self._client, self._config, self._serialize, self._deserialize)
110109

111-
def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
110+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
112111
"""Runs the network request through the client's chained policies.
113112
114113
>>> from azure.core.rest import HttpRequest
115114
>>> request = HttpRequest("GET", "https://www.example.org/")
116115
<HttpRequest [GET], url: 'https://www.example.org/'>
117-
>>> response = client._send_request(request)
116+
>>> response = client.send_request(request)
118117
<HttpResponse: 200 OK>
119118
120119
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -127,13 +126,17 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
127126
"""
128127

129128
request_copy = deepcopy(request)
130-
request_copy.url = self._client.format_url(request_copy.url)
129+
path_format_arguments = {
130+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
131+
}
132+
133+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
131134
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
132135

133136
def close(self) -> None:
134137
self._client.close()
135138

136-
def __enter__(self) -> "AzureSphereMgmtClient":
139+
def __enter__(self) -> Self:
137140
self._client.__enter__()
138141
return self
139142

0 commit comments

Comments
 (0)