Skip to content

Commit 8f6d008

Browse files
authored
Update autogenerated part of the client (#711)
* Replaced _client with new autogenerated one * Update Workspace convinience layer, update test recordings with new api version
1 parent 8c9f74e commit 8f6d008

File tree

164 files changed

+5904
-3244
lines changed

Some content is hidden

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

164 files changed

+5904
-3244
lines changed

azure-quantum/azure/quantum/_client/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
if TYPE_CHECKING:
1313
from ._patch import * # pylint: disable=unused-wildcard-import
1414

15-
from ._client import ServicesClient # type: ignore
15+
from ._client import WorkspaceClient # type: ignore
1616
from ._version import VERSION
1717

1818
__version__ = VERSION
@@ -25,7 +25,7 @@
2525
from ._patch import patch_sdk as _patch_sdk
2626

2727
__all__ = [
28-
"ServicesClient",
28+
"WorkspaceClient",
2929
]
3030
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
3131

azure-quantum/azure/quantum/_client/_client.py

Lines changed: 18 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -15,67 +15,36 @@
1515
from azure.core.pipeline import policies
1616
from azure.core.rest import HttpRequest, HttpResponse
1717

18-
from ._configuration import ServicesClientConfiguration
19-
from ._serialization import Deserializer, Serializer
20-
from .operations import (
21-
JobsOperations,
22-
ProvidersOperations,
23-
QuotasOperations,
24-
SessionsOperations,
25-
StorageOperations,
26-
TopLevelItemsOperations,
27-
)
18+
from ._configuration import WorkspaceClientConfiguration
19+
from ._utils.serialization import Deserializer, Serializer
20+
from .operations import ServicesOperations
2821

2922
if TYPE_CHECKING:
3023
from azure.core.credentials import TokenCredential
3124

3225

33-
class ServicesClient:
26+
class WorkspaceClient:
3427
"""Azure Quantum Workspace Services.
3528
36-
:ivar jobs: JobsOperations operations
37-
:vartype jobs: azure.quantum.operations.JobsOperations
38-
:ivar sessions: SessionsOperations operations
39-
:vartype sessions: azure.quantum.operations.SessionsOperations
40-
:ivar providers: ProvidersOperations operations
41-
:vartype providers: azure.quantum.operations.ProvidersOperations
42-
:ivar storage: StorageOperations operations
43-
:vartype storage: azure.quantum.operations.StorageOperations
44-
:ivar quotas: QuotasOperations operations
45-
:vartype quotas: azure.quantum.operations.QuotasOperations
46-
:ivar top_level_items: TopLevelItemsOperations operations
47-
:vartype top_level_items: azure.quantum.operations.TopLevelItemsOperations
48-
:param region: The Azure region where the Azure Quantum Workspace is located. Required.
49-
:type region: str
50-
:param credential: Credential used to authenticate requests to the service. Is either a
51-
TokenCredential type or a AzureKeyCredential type. Required.
29+
:ivar services: ServicesOperations operations
30+
:vartype services: azure.quantum.operations.ServicesOperations
31+
:param endpoint: The endpoint of the Azure Quantum service. For example,
32+
https://{region}.quantum.azure.com. Required.
33+
:type endpoint: str
34+
:param credential: Credential used to authenticate requests to the service. Is either a token
35+
credential type or a key credential type. Required.
5236
:type credential: ~azure.core.credentials.TokenCredential or
5337
~azure.core.credentials.AzureKeyCredential
54-
:keyword service_base_url: The Azure Quantum service base url. Default value is
55-
"quantum.azure.com".
56-
:paramtype service_base_url: str
5738
:keyword api_version: The API version to use for this operation. Default value is
58-
"2024-10-01-preview". Note that overriding this default value may result in unsupported
39+
"2025-12-01-preview". Note that overriding this default value may result in unsupported
5940
behavior.
6041
:paramtype api_version: str
6142
"""
6243

63-
def __init__(
64-
self,
65-
region: str,
66-
credential: Union["TokenCredential", AzureKeyCredential],
67-
*,
68-
service_base_url: str = "quantum.azure.com",
69-
endpoint: str = None,
70-
**kwargs: Any
71-
) -> None:
72-
if endpoint is not None:
73-
_endpoint = endpoint
74-
else:
75-
_endpoint = "https://{region}.{serviceBaseUrl}"
76-
self._config = ServicesClientConfiguration(
77-
region=region, credential=credential, service_base_url=service_base_url, **kwargs
78-
)
44+
def __init__(self, endpoint: str, credential: Union["TokenCredential", AzureKeyCredential], **kwargs: Any) -> None:
45+
_endpoint = "{endpoint}"
46+
self._config = WorkspaceClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
47+
7948
_policies = kwargs.pop("policies", None)
8049
if _policies is None:
8150
_policies = [
@@ -98,12 +67,7 @@ def __init__(
9867
self._serialize = Serializer()
9968
self._deserialize = Deserializer()
10069
self._serialize.client_side_validation = False
101-
self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize)
102-
self.sessions = SessionsOperations(self._client, self._config, self._serialize, self._deserialize)
103-
self.providers = ProvidersOperations(self._client, self._config, self._serialize, self._deserialize)
104-
self.storage = StorageOperations(self._client, self._config, self._serialize, self._deserialize)
105-
self.quotas = QuotasOperations(self._client, self._config, self._serialize, self._deserialize)
106-
self.top_level_items = TopLevelItemsOperations(self._client, self._config, self._serialize, self._deserialize)
70+
self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize)
10771

10872
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
10973
"""Runs the network request through the client's chained policies.
@@ -125,10 +89,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
12589

12690
request_copy = deepcopy(request)
12791
path_format_arguments = {
128-
"region": self._serialize.url("self._config.region", self._config.region, "str"),
129-
"serviceBaseUrl": self._serialize.url(
130-
"self._config.service_base_url", self._config.service_base_url, "str"
131-
),
92+
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
13293
}
13394

13495
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)

azure-quantum/azure/quantum/_client/_configuration.py

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,44 +17,35 @@
1717
from azure.core.credentials import TokenCredential
1818

1919

20-
class ServicesClientConfiguration: # pylint: disable=too-many-instance-attributes
21-
"""Configuration for ServicesClient.
20+
class WorkspaceClientConfiguration: # pylint: disable=too-many-instance-attributes
21+
"""Configuration for WorkspaceClient.
2222
2323
Note that all parameters used to create this instance are saved as instance
2424
attributes.
2525
26-
:param region: The Azure region where the Azure Quantum Workspace is located. Required.
27-
:type region: str
28-
:param credential: Credential used to authenticate requests to the service. Is either a
29-
TokenCredential type or a AzureKeyCredential type. Required.
26+
:param endpoint: The endpoint of the Azure Quantum service. For example,
27+
https://{region}.quantum.azure.com. Required.
28+
:type endpoint: str
29+
:param credential: Credential used to authenticate requests to the service. Is either a token
30+
credential type or a key credential type. Required.
3031
:type credential: ~azure.core.credentials.TokenCredential or
3132
~azure.core.credentials.AzureKeyCredential
32-
:param service_base_url: The Azure Quantum service base url. Default value is
33-
"quantum.azure.com".
34-
:type service_base_url: str
3533
:keyword api_version: The API version to use for this operation. Default value is
36-
"2024-10-01-preview". Note that overriding this default value may result in unsupported
34+
"2025-12-01-preview". Note that overriding this default value may result in unsupported
3735
behavior.
3836
:paramtype api_version: str
3937
"""
4038

41-
def __init__(
42-
self,
43-
region: str,
44-
credential: Union["TokenCredential", AzureKeyCredential],
45-
service_base_url: str = "quantum.azure.com",
46-
**kwargs: Any,
47-
) -> None:
48-
api_version: str = kwargs.pop("api_version", "2024-10-01-preview")
39+
def __init__(self, endpoint: str, credential: Union["TokenCredential", AzureKeyCredential], **kwargs: Any) -> None:
40+
api_version: str = kwargs.pop("api_version", "2025-12-01-preview")
4941

50-
if region is None:
51-
raise ValueError("Parameter 'region' must not be None.")
42+
if endpoint is None:
43+
raise ValueError("Parameter 'endpoint' must not be None.")
5244
if credential is None:
5345
raise ValueError("Parameter 'credential' must not be None.")
5446

55-
self.region = region
47+
self.endpoint = endpoint
5648
self.credential = credential
57-
self.service_base_url = service_base_url
5849
self.api_version = api_version
5950
self.credential_scopes = kwargs.pop("credential_scopes", ["https://quantum.microsoft.com/.default"])
6051
kwargs.setdefault("sdk_moniker", "quantum/{}".format(VERSION))

azure-quantum/azure/quantum/_client/_patch.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
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
89
"""
9-
from typing import List
1010

11-
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
11+
12+
__all__: list[str] = [] # Add all objects you want publicly available to users at this package level
1213

1314

1415
def patch_sdk():
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+
# --------------------------------------------------------------------------

0 commit comments

Comments
 (0)