azure-quantum 2.3.0__py3-none-any.whl → 2.5.0.dev0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- azure/quantum/_client/__init__.py +11 -5
- azure/quantum/_client/_client.py +40 -49
- azure/quantum/_client/_configuration.py +34 -41
- azure/quantum/_client/_model_base.py +1159 -0
- azure/quantum/_client/_serialization.py +285 -172
- azure/quantum/_client/_version.py +1 -1
- azure/quantum/_client/aio/__init__.py +29 -0
- azure/quantum/_client/aio/_client.py +143 -0
- azure/quantum/_client/aio/_configuration.py +82 -0
- azure/quantum/_client/aio/_patch.py +20 -0
- azure/quantum/_client/aio/operations/__init__.py +35 -0
- azure/quantum/_client/aio/operations/_operations.py +1824 -0
- azure/quantum/_client/aio/operations/_patch.py +20 -0
- azure/quantum/_client/models/__init__.py +41 -30
- azure/quantum/_client/models/_enums.py +34 -4
- azure/quantum/_client/models/_models.py +435 -764
- azure/quantum/_client/operations/__init__.py +16 -10
- azure/quantum/_client/operations/_operations.py +1191 -769
- azure/quantum/_client/py.typed +1 -0
- azure/quantum/target/microsoft/elements/dft/target.py +2 -1
- azure/quantum/target/rigetti/target.py +1 -1
- azure/quantum/version.py +1 -1
- azure/quantum/workspace.py +371 -38
- {azure_quantum-2.3.0.dist-info → azure_quantum-2.5.0.dev0.dist-info}/METADATA +1 -1
- {azure_quantum-2.3.0.dist-info → azure_quantum-2.5.0.dev0.dist-info}/RECORD +27 -19
- azure/quantum/_client/_vendor.py +0 -20
- {azure_quantum-2.3.0.dist-info → azure_quantum-2.5.0.dev0.dist-info}/WHEEL +0 -0
- {azure_quantum-2.3.0.dist-info → azure_quantum-2.5.0.dev0.dist-info}/top_level.txt +0 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
# pylint: disable=too-many-lines
|
|
1
|
+
# pylint: disable=too-many-lines
|
|
2
2
|
# coding=utf-8
|
|
3
3
|
# --------------------------------------------------------------------------
|
|
4
4
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
5
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
|
-
# Code generated by Microsoft (R)
|
|
6
|
+
# Code generated by Microsoft (R) Python Code Generator.
|
|
7
7
|
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
8
8
|
# --------------------------------------------------------------------------
|
|
9
9
|
from io import IOBase
|
|
10
|
+
import json
|
|
11
|
+
import sys
|
|
10
12
|
from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, overload
|
|
11
13
|
import urllib.parse
|
|
12
14
|
|
|
@@ -16,6 +18,8 @@ from azure.core.exceptions import (
|
|
|
16
18
|
ResourceExistsError,
|
|
17
19
|
ResourceNotFoundError,
|
|
18
20
|
ResourceNotModifiedError,
|
|
21
|
+
StreamClosedError,
|
|
22
|
+
StreamConsumedError,
|
|
19
23
|
map_error,
|
|
20
24
|
)
|
|
21
25
|
from azure.core.paging import ItemPaged
|
|
@@ -25,8 +29,14 @@ from azure.core.tracing.decorator import distributed_trace
|
|
|
25
29
|
from azure.core.utils import case_insensitive_dict
|
|
26
30
|
|
|
27
31
|
from .. import models as _models
|
|
32
|
+
from .._model_base import SdkJSONEncoder, _deserialize
|
|
28
33
|
from .._serialization import Serializer
|
|
29
34
|
|
|
35
|
+
if sys.version_info >= (3, 9):
|
|
36
|
+
from collections.abc import MutableMapping
|
|
37
|
+
else:
|
|
38
|
+
from typing import MutableMapping # type: ignore
|
|
39
|
+
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
|
|
30
40
|
T = TypeVar("T")
|
|
31
41
|
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
|
|
32
42
|
|
|
@@ -34,21 +44,23 @@ _SERIALIZER = Serializer()
|
|
|
34
44
|
_SERIALIZER.client_side_validation = False
|
|
35
45
|
|
|
36
46
|
|
|
37
|
-
def
|
|
38
|
-
subscription_id: str, resource_group_name: str, workspace_name: str, **kwargs: Any
|
|
47
|
+
def build_jobs_create_or_replace_request(
|
|
48
|
+
subscription_id: str, resource_group_name: str, workspace_name: str, job_id: str, **kwargs: Any
|
|
39
49
|
) -> HttpRequest:
|
|
40
50
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
41
51
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
42
52
|
|
|
43
|
-
|
|
53
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
54
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview"))
|
|
44
55
|
accept = _headers.pop("Accept", "application/json")
|
|
45
56
|
|
|
46
57
|
# Construct URL
|
|
47
|
-
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs" # pylint: disable=line-too-long
|
|
58
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs/{jobId}" # pylint: disable=line-too-long
|
|
48
59
|
path_format_arguments = {
|
|
49
60
|
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
50
61
|
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
51
62
|
"workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"),
|
|
63
|
+
"jobId": _SERIALIZER.url("job_id", job_id, "str"),
|
|
52
64
|
}
|
|
53
65
|
|
|
54
66
|
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
@@ -57,18 +69,21 @@ def build_jobs_list_request(
|
|
|
57
69
|
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
58
70
|
|
|
59
71
|
# Construct headers
|
|
72
|
+
if content_type is not None:
|
|
73
|
+
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
60
74
|
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
61
75
|
|
|
62
|
-
return HttpRequest(method="
|
|
76
|
+
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
|
|
63
77
|
|
|
64
78
|
|
|
65
|
-
def
|
|
66
|
-
|
|
79
|
+
def build_jobs_update_request(
|
|
80
|
+
subscription_id: str, resource_group_name: str, workspace_name: str, job_id: str, **kwargs: Any
|
|
67
81
|
) -> HttpRequest:
|
|
68
82
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
69
83
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
70
84
|
|
|
71
|
-
|
|
85
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
86
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview"))
|
|
72
87
|
accept = _headers.pop("Accept", "application/json")
|
|
73
88
|
|
|
74
89
|
# Construct URL
|
|
@@ -77,13 +92,7 @@ def build_jobs_get_request(
|
|
|
77
92
|
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
78
93
|
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
79
94
|
"workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"),
|
|
80
|
-
"jobId": _SERIALIZER.url(
|
|
81
|
-
"job_id",
|
|
82
|
-
job_id,
|
|
83
|
-
"str",
|
|
84
|
-
max_length=36,
|
|
85
|
-
pattern=r"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
|
|
86
|
-
),
|
|
95
|
+
"jobId": _SERIALIZER.url("job_id", job_id, "str"),
|
|
87
96
|
}
|
|
88
97
|
|
|
89
98
|
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
@@ -92,19 +101,20 @@ def build_jobs_get_request(
|
|
|
92
101
|
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
93
102
|
|
|
94
103
|
# Construct headers
|
|
104
|
+
if content_type is not None:
|
|
105
|
+
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
95
106
|
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
96
107
|
|
|
97
|
-
return HttpRequest(method="
|
|
108
|
+
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
|
|
98
109
|
|
|
99
110
|
|
|
100
|
-
def
|
|
101
|
-
|
|
111
|
+
def build_jobs_delete_request(
|
|
112
|
+
subscription_id: str, resource_group_name: str, workspace_name: str, job_id: str, **kwargs: Any
|
|
102
113
|
) -> HttpRequest:
|
|
103
114
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
104
115
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
105
116
|
|
|
106
|
-
|
|
107
|
-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-13-preview"))
|
|
117
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview"))
|
|
108
118
|
accept = _headers.pop("Accept", "application/json")
|
|
109
119
|
|
|
110
120
|
# Construct URL
|
|
@@ -113,13 +123,7 @@ def build_jobs_create_request(
|
|
|
113
123
|
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
114
124
|
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
115
125
|
"workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"),
|
|
116
|
-
"jobId": _SERIALIZER.url(
|
|
117
|
-
"job_id",
|
|
118
|
-
job_id,
|
|
119
|
-
"str",
|
|
120
|
-
max_length=36,
|
|
121
|
-
pattern=r"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
|
|
122
|
-
),
|
|
126
|
+
"jobId": _SERIALIZER.url("job_id", job_id, "str"),
|
|
123
127
|
}
|
|
124
128
|
|
|
125
129
|
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
@@ -128,20 +132,18 @@ def build_jobs_create_request(
|
|
|
128
132
|
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
129
133
|
|
|
130
134
|
# Construct headers
|
|
131
|
-
if content_type is not None:
|
|
132
|
-
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
133
135
|
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
134
136
|
|
|
135
|
-
return HttpRequest(method="
|
|
137
|
+
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
|
|
136
138
|
|
|
137
139
|
|
|
138
|
-
def
|
|
139
|
-
|
|
140
|
+
def build_jobs_get_request(
|
|
141
|
+
subscription_id: str, resource_group_name: str, workspace_name: str, job_id: str, **kwargs: Any
|
|
140
142
|
) -> HttpRequest:
|
|
141
143
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
142
144
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
143
145
|
|
|
144
|
-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "
|
|
146
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview"))
|
|
145
147
|
accept = _headers.pop("Accept", "application/json")
|
|
146
148
|
|
|
147
149
|
# Construct URL
|
|
@@ -150,13 +152,7 @@ def build_jobs_cancel_request(
|
|
|
150
152
|
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
151
153
|
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
152
154
|
"workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"),
|
|
153
|
-
"jobId": _SERIALIZER.url(
|
|
154
|
-
"job_id",
|
|
155
|
-
job_id,
|
|
156
|
-
"str",
|
|
157
|
-
max_length=36,
|
|
158
|
-
pattern=r"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
|
|
159
|
-
),
|
|
155
|
+
"jobId": _SERIALIZER.url("job_id", job_id, "str"),
|
|
160
156
|
}
|
|
161
157
|
|
|
162
158
|
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
@@ -167,62 +163,70 @@ def build_jobs_cancel_request(
|
|
|
167
163
|
# Construct headers
|
|
168
164
|
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
169
165
|
|
|
170
|
-
return HttpRequest(method="
|
|
166
|
+
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
171
167
|
|
|
172
168
|
|
|
173
|
-
def
|
|
174
|
-
|
|
169
|
+
def build_jobs_list_request(
|
|
170
|
+
subscription_id: str,
|
|
171
|
+
resource_group_name: str,
|
|
172
|
+
workspace_name: str,
|
|
173
|
+
*,
|
|
174
|
+
filter: Optional[str] = None,
|
|
175
|
+
skip: Optional[int] = None,
|
|
176
|
+
top: Optional[int] = None,
|
|
177
|
+
orderby: Optional[str] = None,
|
|
178
|
+
**kwargs: Any
|
|
175
179
|
) -> HttpRequest:
|
|
176
180
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
177
181
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
178
182
|
|
|
179
|
-
|
|
180
|
-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-13-preview"))
|
|
183
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview"))
|
|
181
184
|
accept = _headers.pop("Accept", "application/json")
|
|
182
185
|
|
|
183
186
|
# Construct URL
|
|
184
|
-
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs
|
|
187
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/jobs" # pylint: disable=line-too-long
|
|
185
188
|
path_format_arguments = {
|
|
186
189
|
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
187
190
|
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
188
191
|
"workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"),
|
|
189
|
-
"jobId": _SERIALIZER.url(
|
|
190
|
-
"job_id",
|
|
191
|
-
job_id,
|
|
192
|
-
"str",
|
|
193
|
-
max_length=36,
|
|
194
|
-
pattern=r"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
|
|
195
|
-
),
|
|
196
192
|
}
|
|
197
193
|
|
|
198
194
|
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
199
195
|
|
|
200
196
|
# Construct parameters
|
|
201
197
|
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
198
|
+
if filter is not None:
|
|
199
|
+
_params["filter"] = _SERIALIZER.query("filter", filter, "str")
|
|
200
|
+
if skip is not None:
|
|
201
|
+
_params["skip"] = _SERIALIZER.query("skip", skip, "int")
|
|
202
|
+
if top is not None:
|
|
203
|
+
_params["top"] = _SERIALIZER.query("top", top, "int")
|
|
204
|
+
if orderby is not None:
|
|
205
|
+
_params["orderby"] = _SERIALIZER.query("orderby", orderby, "str")
|
|
202
206
|
|
|
203
207
|
# Construct headers
|
|
204
|
-
if content_type is not None:
|
|
205
|
-
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
206
208
|
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
207
209
|
|
|
208
|
-
return HttpRequest(method="
|
|
210
|
+
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
209
211
|
|
|
210
212
|
|
|
211
|
-
def
|
|
212
|
-
subscription_id: str, resource_group_name: str, workspace_name: str, **kwargs: Any
|
|
213
|
+
def build_sessions_create_or_replace_request(
|
|
214
|
+
subscription_id: str, resource_group_name: str, workspace_name: str, session_id: str, **kwargs: Any
|
|
213
215
|
) -> HttpRequest:
|
|
214
216
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
215
217
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
216
218
|
|
|
217
|
-
|
|
219
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
220
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview"))
|
|
218
221
|
accept = _headers.pop("Accept", "application/json")
|
|
219
222
|
|
|
220
223
|
# Construct URL
|
|
221
|
-
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/
|
|
224
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/sessions/{sessionId}" # pylint: disable=line-too-long
|
|
222
225
|
path_format_arguments = {
|
|
223
226
|
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
224
227
|
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
225
228
|
"workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"),
|
|
229
|
+
"sessionId": _SERIALIZER.url("session_id", session_id, "str"),
|
|
226
230
|
}
|
|
227
231
|
|
|
228
232
|
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
@@ -231,27 +235,29 @@ def build_providers_get_status_request(
|
|
|
231
235
|
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
232
236
|
|
|
233
237
|
# Construct headers
|
|
238
|
+
if content_type is not None:
|
|
239
|
+
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
234
240
|
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
235
241
|
|
|
236
|
-
return HttpRequest(method="
|
|
242
|
+
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
|
|
237
243
|
|
|
238
244
|
|
|
239
|
-
def
|
|
240
|
-
subscription_id: str, resource_group_name: str, workspace_name: str, **kwargs: Any
|
|
245
|
+
def build_sessions_close_request(
|
|
246
|
+
subscription_id: str, resource_group_name: str, workspace_name: str, session_id: str, **kwargs: Any
|
|
241
247
|
) -> HttpRequest:
|
|
242
248
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
243
249
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
244
250
|
|
|
245
|
-
|
|
246
|
-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-13-preview"))
|
|
251
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview"))
|
|
247
252
|
accept = _headers.pop("Accept", "application/json")
|
|
248
253
|
|
|
249
254
|
# Construct URL
|
|
250
|
-
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/
|
|
255
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/sessions/{sessionId}:close" # pylint: disable=line-too-long
|
|
251
256
|
path_format_arguments = {
|
|
252
257
|
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
253
258
|
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
254
259
|
"workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"),
|
|
260
|
+
"sessionId": _SERIALIZER.url("session_id", session_id, "str"),
|
|
255
261
|
}
|
|
256
262
|
|
|
257
263
|
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
@@ -260,28 +266,27 @@ def build_storage_sas_uri_request(
|
|
|
260
266
|
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
261
267
|
|
|
262
268
|
# Construct headers
|
|
263
|
-
if content_type is not None:
|
|
264
|
-
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
265
269
|
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
266
270
|
|
|
267
271
|
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
|
|
268
272
|
|
|
269
273
|
|
|
270
|
-
def
|
|
271
|
-
subscription_id: str, resource_group_name: str, workspace_name: str, **kwargs: Any
|
|
274
|
+
def build_sessions_get_request(
|
|
275
|
+
subscription_id: str, resource_group_name: str, workspace_name: str, session_id: str, **kwargs: Any
|
|
272
276
|
) -> HttpRequest:
|
|
273
277
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
274
278
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
275
279
|
|
|
276
|
-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "
|
|
280
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview"))
|
|
277
281
|
accept = _headers.pop("Accept", "application/json")
|
|
278
282
|
|
|
279
283
|
# Construct URL
|
|
280
|
-
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/
|
|
284
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/sessions/{sessionId}" # pylint: disable=line-too-long
|
|
281
285
|
path_format_arguments = {
|
|
282
286
|
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
283
287
|
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
284
288
|
"workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"),
|
|
289
|
+
"sessionId": _SERIALIZER.url("session_id", session_id, "str"),
|
|
285
290
|
}
|
|
286
291
|
|
|
287
292
|
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
@@ -296,12 +301,20 @@ def build_quotas_list_request(
|
|
|
296
301
|
|
|
297
302
|
|
|
298
303
|
def build_sessions_list_request(
|
|
299
|
-
subscription_id: str,
|
|
304
|
+
subscription_id: str,
|
|
305
|
+
resource_group_name: str,
|
|
306
|
+
workspace_name: str,
|
|
307
|
+
*,
|
|
308
|
+
filter: Optional[str] = None,
|
|
309
|
+
skip: Optional[int] = None,
|
|
310
|
+
top: Optional[int] = None,
|
|
311
|
+
orderby: Optional[str] = None,
|
|
312
|
+
**kwargs: Any
|
|
300
313
|
) -> HttpRequest:
|
|
301
314
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
302
315
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
303
316
|
|
|
304
|
-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "
|
|
317
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview"))
|
|
305
318
|
accept = _headers.pop("Accept", "application/json")
|
|
306
319
|
|
|
307
320
|
# Construct URL
|
|
@@ -316,6 +329,14 @@ def build_sessions_list_request(
|
|
|
316
329
|
|
|
317
330
|
# Construct parameters
|
|
318
331
|
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
332
|
+
if filter is not None:
|
|
333
|
+
_params["filter"] = _SERIALIZER.query("filter", filter, "str")
|
|
334
|
+
if skip is not None:
|
|
335
|
+
_params["skip"] = _SERIALIZER.query("skip", skip, "int")
|
|
336
|
+
if top is not None:
|
|
337
|
+
_params["top"] = _SERIALIZER.query("top", top, "int")
|
|
338
|
+
if orderby is not None:
|
|
339
|
+
_params["orderby"] = _SERIALIZER.query("orderby", orderby, "str")
|
|
319
340
|
|
|
320
341
|
# Construct headers
|
|
321
342
|
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
@@ -323,34 +344,45 @@ def build_sessions_list_request(
|
|
|
323
344
|
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
324
345
|
|
|
325
346
|
|
|
326
|
-
def
|
|
327
|
-
|
|
347
|
+
def build_sessions_jobs_list_request(
|
|
348
|
+
subscription_id: str,
|
|
349
|
+
resource_group_name: str,
|
|
350
|
+
workspace_name: str,
|
|
351
|
+
session_id: str,
|
|
352
|
+
*,
|
|
353
|
+
filter: Optional[str] = None,
|
|
354
|
+
skip: Optional[int] = None,
|
|
355
|
+
top: Optional[int] = None,
|
|
356
|
+
orderby: Optional[str] = None,
|
|
357
|
+
**kwargs: Any
|
|
328
358
|
) -> HttpRequest:
|
|
329
359
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
330
360
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
331
361
|
|
|
332
|
-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "
|
|
362
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview"))
|
|
333
363
|
accept = _headers.pop("Accept", "application/json")
|
|
334
364
|
|
|
335
365
|
# Construct URL
|
|
336
|
-
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/sessions/{sessionId}" # pylint: disable=line-too-long
|
|
366
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/sessions/{sessionId}/jobs" # pylint: disable=line-too-long
|
|
337
367
|
path_format_arguments = {
|
|
338
368
|
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
339
369
|
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
340
370
|
"workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"),
|
|
341
|
-
"sessionId": _SERIALIZER.url(
|
|
342
|
-
"session_id",
|
|
343
|
-
session_id,
|
|
344
|
-
"str",
|
|
345
|
-
max_length=36,
|
|
346
|
-
pattern=r"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
|
|
347
|
-
),
|
|
371
|
+
"sessionId": _SERIALIZER.url("session_id", session_id, "str"),
|
|
348
372
|
}
|
|
349
373
|
|
|
350
374
|
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
351
375
|
|
|
352
376
|
# Construct parameters
|
|
353
377
|
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
378
|
+
if filter is not None:
|
|
379
|
+
_params["filter"] = _SERIALIZER.query("filter", filter, "str")
|
|
380
|
+
if skip is not None:
|
|
381
|
+
_params["skip"] = _SERIALIZER.query("skip", skip, "int")
|
|
382
|
+
if top is not None:
|
|
383
|
+
_params["top"] = _SERIALIZER.query("top", top, "int")
|
|
384
|
+
if orderby is not None:
|
|
385
|
+
_params["orderby"] = _SERIALIZER.query("orderby", orderby, "str")
|
|
354
386
|
|
|
355
387
|
# Construct headers
|
|
356
388
|
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
@@ -358,29 +390,21 @@ def build_sessions_get_request(
|
|
|
358
390
|
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
359
391
|
|
|
360
392
|
|
|
361
|
-
def
|
|
362
|
-
|
|
393
|
+
def build_providers_list_request(
|
|
394
|
+
subscription_id: str, resource_group_name: str, workspace_name: str, **kwargs: Any
|
|
363
395
|
) -> HttpRequest:
|
|
364
396
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
365
397
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
366
398
|
|
|
367
|
-
|
|
368
|
-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-13-preview"))
|
|
399
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview"))
|
|
369
400
|
accept = _headers.pop("Accept", "application/json")
|
|
370
401
|
|
|
371
402
|
# Construct URL
|
|
372
|
-
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/
|
|
403
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/providerStatus" # pylint: disable=line-too-long
|
|
373
404
|
path_format_arguments = {
|
|
374
405
|
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
375
406
|
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
376
407
|
"workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"),
|
|
377
|
-
"sessionId": _SERIALIZER.url(
|
|
378
|
-
"session_id",
|
|
379
|
-
session_id,
|
|
380
|
-
"str",
|
|
381
|
-
max_length=36,
|
|
382
|
-
pattern=r"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
|
|
383
|
-
),
|
|
384
408
|
}
|
|
385
409
|
|
|
386
410
|
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
@@ -389,35 +413,27 @@ def build_sessions_open_request(
|
|
|
389
413
|
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
390
414
|
|
|
391
415
|
# Construct headers
|
|
392
|
-
if content_type is not None:
|
|
393
|
-
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
394
416
|
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
395
417
|
|
|
396
|
-
return HttpRequest(method="
|
|
418
|
+
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
|
|
397
419
|
|
|
398
420
|
|
|
399
|
-
def
|
|
400
|
-
|
|
421
|
+
def build_storage_get_sas_uri_request(
|
|
422
|
+
subscription_id: str, resource_group_name: str, workspace_name: str, **kwargs: Any
|
|
401
423
|
) -> HttpRequest:
|
|
402
424
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
403
425
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
404
426
|
|
|
405
|
-
|
|
427
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
428
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview"))
|
|
406
429
|
accept = _headers.pop("Accept", "application/json")
|
|
407
430
|
|
|
408
431
|
# Construct URL
|
|
409
|
-
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/
|
|
432
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/storage/sasUri" # pylint: disable=line-too-long
|
|
410
433
|
path_format_arguments = {
|
|
411
434
|
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
412
435
|
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
413
436
|
"workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"),
|
|
414
|
-
"sessionId": _SERIALIZER.url(
|
|
415
|
-
"session_id",
|
|
416
|
-
session_id,
|
|
417
|
-
"str",
|
|
418
|
-
max_length=36,
|
|
419
|
-
pattern=r"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
|
|
420
|
-
),
|
|
421
437
|
}
|
|
422
438
|
|
|
423
439
|
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
@@ -426,33 +442,28 @@ def build_sessions_close_request(
|
|
|
426
442
|
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
427
443
|
|
|
428
444
|
# Construct headers
|
|
445
|
+
if content_type is not None:
|
|
446
|
+
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
|
|
429
447
|
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
430
448
|
|
|
431
449
|
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
|
|
432
450
|
|
|
433
451
|
|
|
434
|
-
def
|
|
435
|
-
|
|
452
|
+
def build_quotas_list_request(
|
|
453
|
+
subscription_id: str, resource_group_name: str, workspace_name: str, **kwargs: Any
|
|
436
454
|
) -> HttpRequest:
|
|
437
455
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
438
456
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
439
457
|
|
|
440
|
-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "
|
|
458
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview"))
|
|
441
459
|
accept = _headers.pop("Accept", "application/json")
|
|
442
460
|
|
|
443
461
|
# Construct URL
|
|
444
|
-
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/
|
|
462
|
+
_url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}/quotas" # pylint: disable=line-too-long
|
|
445
463
|
path_format_arguments = {
|
|
446
464
|
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"),
|
|
447
465
|
"resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"),
|
|
448
466
|
"workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"),
|
|
449
|
-
"sessionId": _SERIALIZER.url(
|
|
450
|
-
"session_id",
|
|
451
|
-
session_id,
|
|
452
|
-
"str",
|
|
453
|
-
max_length=36,
|
|
454
|
-
pattern=r"^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
|
|
455
|
-
),
|
|
456
467
|
}
|
|
457
468
|
|
|
458
469
|
_url: str = _url.format(**path_format_arguments) # type: ignore
|
|
@@ -467,12 +478,20 @@ def build_sessions_jobs_list_request(
|
|
|
467
478
|
|
|
468
479
|
|
|
469
480
|
def build_top_level_items_list_request(
|
|
470
|
-
subscription_id: str,
|
|
481
|
+
subscription_id: str,
|
|
482
|
+
resource_group_name: str,
|
|
483
|
+
workspace_name: str,
|
|
484
|
+
*,
|
|
485
|
+
filter: Optional[str] = None,
|
|
486
|
+
skip: Optional[int] = None,
|
|
487
|
+
top: Optional[int] = None,
|
|
488
|
+
orderby: Optional[str] = None,
|
|
489
|
+
**kwargs: Any
|
|
471
490
|
) -> HttpRequest:
|
|
472
491
|
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
473
492
|
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
474
493
|
|
|
475
|
-
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "
|
|
494
|
+
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview"))
|
|
476
495
|
accept = _headers.pop("Accept", "application/json")
|
|
477
496
|
|
|
478
497
|
# Construct URL
|
|
@@ -487,6 +506,14 @@ def build_top_level_items_list_request(
|
|
|
487
506
|
|
|
488
507
|
# Construct parameters
|
|
489
508
|
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
|
|
509
|
+
if filter is not None:
|
|
510
|
+
_params["filter"] = _SERIALIZER.query("filter", filter, "str")
|
|
511
|
+
if skip is not None:
|
|
512
|
+
_params["skip"] = _SERIALIZER.query("skip", skip, "int")
|
|
513
|
+
if top is not None:
|
|
514
|
+
_params["top"] = _SERIALIZER.query("top", top, "int")
|
|
515
|
+
if orderby is not None:
|
|
516
|
+
_params["orderby"] = _SERIALIZER.query("orderby", orderby, "str")
|
|
490
517
|
|
|
491
518
|
# Construct headers
|
|
492
519
|
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
|
|
@@ -500,12 +527,10 @@ class JobsOperations:
|
|
|
500
527
|
**DO NOT** instantiate this class directly.
|
|
501
528
|
|
|
502
529
|
Instead, you should access the following operations through
|
|
503
|
-
:class:`~azure.quantum.
|
|
530
|
+
:class:`~azure.quantum.ServicesClient`'s
|
|
504
531
|
:attr:`jobs` attribute.
|
|
505
532
|
"""
|
|
506
533
|
|
|
507
|
-
models = _models
|
|
508
|
-
|
|
509
534
|
def __init__(self, *args, **kwargs):
|
|
510
535
|
input_args = list(args)
|
|
511
536
|
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
|
|
@@ -513,107 +538,130 @@ class JobsOperations:
|
|
|
513
538
|
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
|
|
514
539
|
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
|
|
515
540
|
|
|
516
|
-
@
|
|
517
|
-
def
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
:
|
|
521
|
-
:
|
|
541
|
+
@overload
|
|
542
|
+
def create_or_replace(
|
|
543
|
+
self,
|
|
544
|
+
subscription_id: str,
|
|
545
|
+
resource_group_name: str,
|
|
546
|
+
workspace_name: str,
|
|
547
|
+
job_id: str,
|
|
548
|
+
resource: _models.JobDetails,
|
|
549
|
+
*,
|
|
550
|
+
content_type: str = "application/json",
|
|
551
|
+
**kwargs: Any
|
|
552
|
+
) -> _models.JobDetails:
|
|
553
|
+
"""Create a new job.
|
|
554
|
+
|
|
555
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
556
|
+
:type subscription_id: str
|
|
557
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
558
|
+
:type resource_group_name: str
|
|
559
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
560
|
+
:type workspace_name: str
|
|
561
|
+
:param job_id: Id of the job. Required.
|
|
562
|
+
:type job_id: str
|
|
563
|
+
:param resource: The resource instance. Required.
|
|
564
|
+
:type resource: ~azure.quantum.models.JobDetails
|
|
565
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
566
|
+
Default value is "application/json".
|
|
567
|
+
:paramtype content_type: str
|
|
568
|
+
:return: JobDetails. The JobDetails is compatible with MutableMapping
|
|
569
|
+
:rtype: ~azure.quantum.models.JobDetails
|
|
522
570
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
523
571
|
"""
|
|
524
|
-
_headers = kwargs.pop("headers", {}) or {}
|
|
525
|
-
_params = kwargs.pop("params", {}) or {}
|
|
526
|
-
|
|
527
|
-
cls: ClsType[_models._models.JobDetailsList] = kwargs.pop("cls", None) # pylint: disable=protected-access
|
|
528
|
-
|
|
529
|
-
error_map = {
|
|
530
|
-
401: ClientAuthenticationError,
|
|
531
|
-
404: ResourceNotFoundError,
|
|
532
|
-
409: ResourceExistsError,
|
|
533
|
-
304: ResourceNotModifiedError,
|
|
534
|
-
}
|
|
535
|
-
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
536
|
-
|
|
537
|
-
def prepare_request(next_link=None):
|
|
538
|
-
if not next_link:
|
|
539
|
-
|
|
540
|
-
_request = build_jobs_list_request(
|
|
541
|
-
subscription_id=self._config.subscription_id,
|
|
542
|
-
resource_group_name=self._config.resource_group_name,
|
|
543
|
-
workspace_name=self._config.workspace_name,
|
|
544
|
-
api_version=self._config.api_version,
|
|
545
|
-
headers=_headers,
|
|
546
|
-
params=_params,
|
|
547
|
-
)
|
|
548
|
-
path_format_arguments = {
|
|
549
|
-
"azureRegion": self._serialize.url(
|
|
550
|
-
"self._config.azure_region", self._config.azure_region, "str", skip_quote=True
|
|
551
|
-
),
|
|
552
|
-
}
|
|
553
|
-
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
554
|
-
|
|
555
|
-
else:
|
|
556
|
-
# make call to next link with the client's api-version
|
|
557
|
-
_parsed_next_link = urllib.parse.urlparse(next_link)
|
|
558
|
-
_next_request_params = case_insensitive_dict(
|
|
559
|
-
{
|
|
560
|
-
key: [urllib.parse.quote(v) for v in value]
|
|
561
|
-
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
|
562
|
-
}
|
|
563
|
-
)
|
|
564
|
-
_next_request_params["api-version"] = self._config.api_version
|
|
565
|
-
_request = HttpRequest(
|
|
566
|
-
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
|
567
|
-
)
|
|
568
|
-
path_format_arguments = {
|
|
569
|
-
"azureRegion": self._serialize.url(
|
|
570
|
-
"self._config.azure_region", self._config.azure_region, "str", skip_quote=True
|
|
571
|
-
),
|
|
572
|
-
}
|
|
573
|
-
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
574
|
-
|
|
575
|
-
return _request
|
|
576
|
-
|
|
577
|
-
def extract_data(pipeline_response):
|
|
578
|
-
deserialized = self._deserialize(
|
|
579
|
-
_models._models.JobDetailsList, pipeline_response # pylint: disable=protected-access
|
|
580
|
-
)
|
|
581
|
-
list_of_elem = deserialized.value
|
|
582
|
-
if cls:
|
|
583
|
-
list_of_elem = cls(list_of_elem) # type: ignore
|
|
584
|
-
return deserialized.next_link or None, iter(list_of_elem)
|
|
585
|
-
|
|
586
|
-
def get_next(next_link=None):
|
|
587
|
-
_request = prepare_request(next_link)
|
|
588
572
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
573
|
+
@overload
|
|
574
|
+
def create_or_replace(
|
|
575
|
+
self,
|
|
576
|
+
subscription_id: str,
|
|
577
|
+
resource_group_name: str,
|
|
578
|
+
workspace_name: str,
|
|
579
|
+
job_id: str,
|
|
580
|
+
resource: JSON,
|
|
581
|
+
*,
|
|
582
|
+
content_type: str = "application/json",
|
|
583
|
+
**kwargs: Any
|
|
584
|
+
) -> _models.JobDetails:
|
|
585
|
+
"""Create a new job.
|
|
586
|
+
|
|
587
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
588
|
+
:type subscription_id: str
|
|
589
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
590
|
+
:type resource_group_name: str
|
|
591
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
592
|
+
:type workspace_name: str
|
|
593
|
+
:param job_id: Id of the job. Required.
|
|
594
|
+
:type job_id: str
|
|
595
|
+
:param resource: The resource instance. Required.
|
|
596
|
+
:type resource: JSON
|
|
597
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
598
|
+
Default value is "application/json".
|
|
599
|
+
:paramtype content_type: str
|
|
600
|
+
:return: JobDetails. The JobDetails is compatible with MutableMapping
|
|
601
|
+
:rtype: ~azure.quantum.models.JobDetails
|
|
602
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
603
|
+
"""
|
|
603
604
|
|
|
604
|
-
|
|
605
|
+
@overload
|
|
606
|
+
def create_or_replace(
|
|
607
|
+
self,
|
|
608
|
+
subscription_id: str,
|
|
609
|
+
resource_group_name: str,
|
|
610
|
+
workspace_name: str,
|
|
611
|
+
job_id: str,
|
|
612
|
+
resource: IO[bytes],
|
|
613
|
+
*,
|
|
614
|
+
content_type: str = "application/json",
|
|
615
|
+
**kwargs: Any
|
|
616
|
+
) -> _models.JobDetails:
|
|
617
|
+
"""Create a new job.
|
|
618
|
+
|
|
619
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
620
|
+
:type subscription_id: str
|
|
621
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
622
|
+
:type resource_group_name: str
|
|
623
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
624
|
+
:type workspace_name: str
|
|
625
|
+
:param job_id: Id of the job. Required.
|
|
626
|
+
:type job_id: str
|
|
627
|
+
:param resource: The resource instance. Required.
|
|
628
|
+
:type resource: IO[bytes]
|
|
629
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
630
|
+
Default value is "application/json".
|
|
631
|
+
:paramtype content_type: str
|
|
632
|
+
:return: JobDetails. The JobDetails is compatible with MutableMapping
|
|
633
|
+
:rtype: ~azure.quantum.models.JobDetails
|
|
634
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
635
|
+
"""
|
|
605
636
|
|
|
606
637
|
@distributed_trace
|
|
607
|
-
def
|
|
608
|
-
|
|
609
|
-
|
|
638
|
+
def create_or_replace(
|
|
639
|
+
self,
|
|
640
|
+
subscription_id: str,
|
|
641
|
+
resource_group_name: str,
|
|
642
|
+
workspace_name: str,
|
|
643
|
+
job_id: str,
|
|
644
|
+
resource: Union[_models.JobDetails, JSON, IO[bytes]],
|
|
645
|
+
**kwargs: Any
|
|
646
|
+
) -> _models.JobDetails:
|
|
647
|
+
"""Create a new job.
|
|
648
|
+
|
|
649
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
650
|
+
:type subscription_id: str
|
|
651
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
652
|
+
:type resource_group_name: str
|
|
653
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
654
|
+
:type workspace_name: str
|
|
610
655
|
:param job_id: Id of the job. Required.
|
|
611
656
|
:type job_id: str
|
|
612
|
-
:
|
|
613
|
-
|
|
657
|
+
:param resource: The resource instance. Is one of the following types: JobDetails, JSON,
|
|
658
|
+
IO[bytes] Required.
|
|
659
|
+
:type resource: ~azure.quantum.models.JobDetails or JSON or IO[bytes]
|
|
660
|
+
:return: JobDetails. The JobDetails is compatible with MutableMapping
|
|
661
|
+
:rtype: ~azure.quantum.models.JobDetails
|
|
614
662
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
615
663
|
"""
|
|
616
|
-
error_map = {
|
|
664
|
+
error_map: MutableMapping = {
|
|
617
665
|
401: ClientAuthenticationError,
|
|
618
666
|
404: ResourceNotFoundError,
|
|
619
667
|
409: ResourceExistsError,
|
|
@@ -621,42 +669,58 @@ class JobsOperations:
|
|
|
621
669
|
}
|
|
622
670
|
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
623
671
|
|
|
624
|
-
_headers = kwargs.pop("headers", {}) or {}
|
|
672
|
+
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
625
673
|
_params = kwargs.pop("params", {}) or {}
|
|
626
674
|
|
|
675
|
+
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
627
676
|
cls: ClsType[_models.JobDetails] = kwargs.pop("cls", None)
|
|
628
677
|
|
|
629
|
-
|
|
678
|
+
content_type = content_type or "application/json"
|
|
679
|
+
_content = None
|
|
680
|
+
if isinstance(resource, (IOBase, bytes)):
|
|
681
|
+
_content = resource
|
|
682
|
+
else:
|
|
683
|
+
_content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore
|
|
684
|
+
|
|
685
|
+
_request = build_jobs_create_or_replace_request(
|
|
686
|
+
subscription_id=subscription_id,
|
|
687
|
+
resource_group_name=resource_group_name,
|
|
688
|
+
workspace_name=workspace_name,
|
|
630
689
|
job_id=job_id,
|
|
631
|
-
|
|
632
|
-
resource_group_name=self._config.resource_group_name,
|
|
633
|
-
workspace_name=self._config.workspace_name,
|
|
690
|
+
content_type=content_type,
|
|
634
691
|
api_version=self._config.api_version,
|
|
692
|
+
content=_content,
|
|
635
693
|
headers=_headers,
|
|
636
694
|
params=_params,
|
|
637
695
|
)
|
|
638
696
|
path_format_arguments = {
|
|
639
|
-
"
|
|
640
|
-
|
|
697
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
698
|
+
"serviceBaseUrl": self._serialize.url(
|
|
699
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
641
700
|
),
|
|
642
701
|
}
|
|
643
702
|
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
644
703
|
|
|
645
|
-
_stream = False
|
|
704
|
+
_stream = kwargs.pop("stream", False)
|
|
646
705
|
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
647
706
|
_request, stream=_stream, **kwargs
|
|
648
707
|
)
|
|
649
708
|
|
|
650
709
|
response = pipeline_response.http_response
|
|
651
710
|
|
|
652
|
-
if response.status_code not in [200]:
|
|
711
|
+
if response.status_code not in [200, 201]:
|
|
653
712
|
if _stream:
|
|
654
|
-
|
|
713
|
+
try:
|
|
714
|
+
response.read() # Load the body in memory and close the socket
|
|
715
|
+
except (StreamConsumedError, StreamClosedError):
|
|
716
|
+
pass
|
|
655
717
|
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
656
|
-
|
|
657
|
-
raise HttpResponseError(response=response, model=error)
|
|
718
|
+
raise HttpResponseError(response=response)
|
|
658
719
|
|
|
659
|
-
|
|
720
|
+
if _stream:
|
|
721
|
+
deserialized = response.iter_bytes()
|
|
722
|
+
else:
|
|
723
|
+
deserialized = _deserialize(_models.JobDetails, response.json())
|
|
660
724
|
|
|
661
725
|
if cls:
|
|
662
726
|
return cls(pipeline_response, deserialized, {}) # type: ignore
|
|
@@ -664,58 +728,97 @@ class JobsOperations:
|
|
|
664
728
|
return deserialized # type: ignore
|
|
665
729
|
|
|
666
730
|
@overload
|
|
667
|
-
def
|
|
668
|
-
self,
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
731
|
+
def update(
|
|
732
|
+
self,
|
|
733
|
+
subscription_id: str,
|
|
734
|
+
resource_group_name: str,
|
|
735
|
+
workspace_name: str,
|
|
736
|
+
job_id: str,
|
|
737
|
+
resource: List[_models.JsonPatchObject],
|
|
738
|
+
*,
|
|
739
|
+
content_type: str = "application/json-patch+json",
|
|
740
|
+
**kwargs: Any
|
|
741
|
+
) -> Optional[_models.JobDetails]:
|
|
742
|
+
"""Update job properties.
|
|
743
|
+
|
|
744
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
745
|
+
:type subscription_id: str
|
|
746
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
747
|
+
:type resource_group_name: str
|
|
748
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
749
|
+
:type workspace_name: str
|
|
672
750
|
:param job_id: Id of the job. Required.
|
|
673
751
|
:type job_id: str
|
|
674
|
-
:param
|
|
675
|
-
:type
|
|
752
|
+
:param resource: The resource instance. Required.
|
|
753
|
+
:type resource: list[~azure.quantum.models.JsonPatchObject]
|
|
676
754
|
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
677
|
-
Default value is "application/json".
|
|
755
|
+
Default value is "application/json-patch+json".
|
|
678
756
|
:paramtype content_type: str
|
|
679
|
-
:return: JobDetails
|
|
680
|
-
:rtype: ~azure.quantum.
|
|
757
|
+
:return: JobDetails or None. The JobDetails is compatible with MutableMapping
|
|
758
|
+
:rtype: ~azure.quantum.models.JobDetails or None
|
|
681
759
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
682
760
|
"""
|
|
683
761
|
|
|
684
762
|
@overload
|
|
685
|
-
def
|
|
686
|
-
self,
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
763
|
+
def update(
|
|
764
|
+
self,
|
|
765
|
+
subscription_id: str,
|
|
766
|
+
resource_group_name: str,
|
|
767
|
+
workspace_name: str,
|
|
768
|
+
job_id: str,
|
|
769
|
+
resource: IO[bytes],
|
|
770
|
+
*,
|
|
771
|
+
content_type: str = "application/json-patch+json",
|
|
772
|
+
**kwargs: Any
|
|
773
|
+
) -> Optional[_models.JobDetails]:
|
|
774
|
+
"""Update job properties.
|
|
775
|
+
|
|
776
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
777
|
+
:type subscription_id: str
|
|
778
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
779
|
+
:type resource_group_name: str
|
|
780
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
781
|
+
:type workspace_name: str
|
|
690
782
|
:param job_id: Id of the job. Required.
|
|
691
783
|
:type job_id: str
|
|
692
|
-
:param
|
|
693
|
-
:type
|
|
784
|
+
:param resource: The resource instance. Required.
|
|
785
|
+
:type resource: IO[bytes]
|
|
694
786
|
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
695
|
-
Default value is "application/json".
|
|
787
|
+
Default value is "application/json-patch+json".
|
|
696
788
|
:paramtype content_type: str
|
|
697
|
-
:return: JobDetails
|
|
698
|
-
:rtype: ~azure.quantum.
|
|
789
|
+
:return: JobDetails or None. The JobDetails is compatible with MutableMapping
|
|
790
|
+
:rtype: ~azure.quantum.models.JobDetails or None
|
|
699
791
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
700
792
|
"""
|
|
701
793
|
|
|
702
794
|
@distributed_trace
|
|
703
|
-
def
|
|
704
|
-
|
|
705
|
-
|
|
795
|
+
def update(
|
|
796
|
+
self,
|
|
797
|
+
subscription_id: str,
|
|
798
|
+
resource_group_name: str,
|
|
799
|
+
workspace_name: str,
|
|
800
|
+
job_id: str,
|
|
801
|
+
resource: Union[List[_models.JsonPatchObject], IO[bytes]],
|
|
802
|
+
**kwargs: Any
|
|
803
|
+
) -> Optional[_models.JobDetails]:
|
|
804
|
+
"""Update job properties.
|
|
805
|
+
|
|
806
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
807
|
+
:type subscription_id: str
|
|
808
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
809
|
+
:type resource_group_name: str
|
|
810
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
811
|
+
:type workspace_name: str
|
|
706
812
|
:param job_id: Id of the job. Required.
|
|
707
813
|
:type job_id: str
|
|
708
|
-
:param
|
|
709
|
-
|
|
710
|
-
:type
|
|
711
|
-
:
|
|
712
|
-
|
|
713
|
-
:paramtype content_type: str
|
|
714
|
-
:return: JobDetails
|
|
715
|
-
:rtype: ~azure.quantum._client.models.JobDetails
|
|
814
|
+
:param resource: The resource instance. Is either a [JsonPatchObject] type or a IO[bytes] type.
|
|
815
|
+
Required.
|
|
816
|
+
:type resource: list[~azure.quantum.models.JsonPatchObject] or IO[bytes]
|
|
817
|
+
:return: JobDetails or None. The JobDetails is compatible with MutableMapping
|
|
818
|
+
:rtype: ~azure.quantum.models.JobDetails or None
|
|
716
819
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
717
820
|
"""
|
|
718
|
-
error_map = {
|
|
821
|
+
error_map: MutableMapping = {
|
|
719
822
|
401: ClientAuthenticationError,
|
|
720
823
|
404: ResourceNotFoundError,
|
|
721
824
|
409: ResourceExistsError,
|
|
@@ -727,54 +830,56 @@ class JobsOperations:
|
|
|
727
830
|
_params = kwargs.pop("params", {}) or {}
|
|
728
831
|
|
|
729
832
|
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
730
|
-
cls: ClsType[_models.JobDetails] = kwargs.pop("cls", None)
|
|
833
|
+
cls: ClsType[Optional[_models.JobDetails]] = kwargs.pop("cls", None)
|
|
731
834
|
|
|
732
|
-
content_type = content_type or "application/json"
|
|
733
|
-
_json = None
|
|
835
|
+
content_type = content_type or "application/json-patch+json"
|
|
734
836
|
_content = None
|
|
735
|
-
if isinstance(
|
|
736
|
-
_content =
|
|
837
|
+
if isinstance(resource, (IOBase, bytes)):
|
|
838
|
+
_content = resource
|
|
737
839
|
else:
|
|
738
|
-
|
|
840
|
+
_content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore
|
|
739
841
|
|
|
740
|
-
_request =
|
|
842
|
+
_request = build_jobs_update_request(
|
|
843
|
+
subscription_id=subscription_id,
|
|
844
|
+
resource_group_name=resource_group_name,
|
|
845
|
+
workspace_name=workspace_name,
|
|
741
846
|
job_id=job_id,
|
|
742
|
-
subscription_id=self._config.subscription_id,
|
|
743
|
-
resource_group_name=self._config.resource_group_name,
|
|
744
|
-
workspace_name=self._config.workspace_name,
|
|
745
847
|
content_type=content_type,
|
|
746
848
|
api_version=self._config.api_version,
|
|
747
|
-
json=_json,
|
|
748
849
|
content=_content,
|
|
749
850
|
headers=_headers,
|
|
750
851
|
params=_params,
|
|
751
852
|
)
|
|
752
853
|
path_format_arguments = {
|
|
753
|
-
"
|
|
754
|
-
|
|
854
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
855
|
+
"serviceBaseUrl": self._serialize.url(
|
|
856
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
755
857
|
),
|
|
756
858
|
}
|
|
757
859
|
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
758
860
|
|
|
759
|
-
_stream = False
|
|
861
|
+
_stream = kwargs.pop("stream", False)
|
|
760
862
|
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
761
863
|
_request, stream=_stream, **kwargs
|
|
762
864
|
)
|
|
763
865
|
|
|
764
866
|
response = pipeline_response.http_response
|
|
765
867
|
|
|
766
|
-
if response.status_code not in [200,
|
|
868
|
+
if response.status_code not in [200, 204]:
|
|
767
869
|
if _stream:
|
|
768
|
-
|
|
870
|
+
try:
|
|
871
|
+
response.read() # Load the body in memory and close the socket
|
|
872
|
+
except (StreamConsumedError, StreamClosedError):
|
|
873
|
+
pass
|
|
769
874
|
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
770
|
-
|
|
771
|
-
raise HttpResponseError(response=response, model=error)
|
|
875
|
+
raise HttpResponseError(response=response)
|
|
772
876
|
|
|
877
|
+
deserialized = None
|
|
773
878
|
if response.status_code == 200:
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
879
|
+
if _stream:
|
|
880
|
+
deserialized = response.iter_bytes()
|
|
881
|
+
else:
|
|
882
|
+
deserialized = _deserialize(_models.JobDetails, response.json())
|
|
778
883
|
|
|
779
884
|
if cls:
|
|
780
885
|
return cls(pipeline_response, deserialized, {}) # type: ignore
|
|
@@ -782,16 +887,24 @@ class JobsOperations:
|
|
|
782
887
|
return deserialized # type: ignore
|
|
783
888
|
|
|
784
889
|
@distributed_trace
|
|
785
|
-
def
|
|
786
|
-
|
|
787
|
-
|
|
890
|
+
def delete( # pylint: disable=inconsistent-return-statements
|
|
891
|
+
self, subscription_id: str, resource_group_name: str, workspace_name: str, job_id: str, **kwargs: Any
|
|
892
|
+
) -> None:
|
|
893
|
+
"""Request the cancellation of an existing job.
|
|
894
|
+
|
|
895
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
896
|
+
:type subscription_id: str
|
|
897
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
898
|
+
:type resource_group_name: str
|
|
899
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
900
|
+
:type workspace_name: str
|
|
788
901
|
:param job_id: Id of the job. Required.
|
|
789
902
|
:type job_id: str
|
|
790
903
|
:return: None
|
|
791
904
|
:rtype: None
|
|
792
905
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
793
906
|
"""
|
|
794
|
-
error_map = {
|
|
907
|
+
error_map: MutableMapping = {
|
|
795
908
|
401: ClientAuthenticationError,
|
|
796
909
|
404: ResourceNotFoundError,
|
|
797
910
|
409: ResourceExistsError,
|
|
@@ -804,18 +917,19 @@ class JobsOperations:
|
|
|
804
917
|
|
|
805
918
|
cls: ClsType[None] = kwargs.pop("cls", None)
|
|
806
919
|
|
|
807
|
-
_request =
|
|
920
|
+
_request = build_jobs_delete_request(
|
|
921
|
+
subscription_id=subscription_id,
|
|
922
|
+
resource_group_name=resource_group_name,
|
|
923
|
+
workspace_name=workspace_name,
|
|
808
924
|
job_id=job_id,
|
|
809
|
-
subscription_id=self._config.subscription_id,
|
|
810
|
-
resource_group_name=self._config.resource_group_name,
|
|
811
|
-
workspace_name=self._config.workspace_name,
|
|
812
925
|
api_version=self._config.api_version,
|
|
813
926
|
headers=_headers,
|
|
814
927
|
params=_params,
|
|
815
928
|
)
|
|
816
929
|
path_format_arguments = {
|
|
817
|
-
"
|
|
818
|
-
|
|
930
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
931
|
+
"serviceBaseUrl": self._serialize.url(
|
|
932
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
819
933
|
),
|
|
820
934
|
}
|
|
821
935
|
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
@@ -828,75 +942,31 @@ class JobsOperations:
|
|
|
828
942
|
response = pipeline_response.http_response
|
|
829
943
|
|
|
830
944
|
if response.status_code not in [204]:
|
|
831
|
-
if _stream:
|
|
832
|
-
response.read() # Load the body in memory and close the socket
|
|
833
945
|
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
834
|
-
|
|
835
|
-
raise HttpResponseError(response=response, model=error)
|
|
946
|
+
raise HttpResponseError(response=response)
|
|
836
947
|
|
|
837
948
|
if cls:
|
|
838
949
|
return cls(pipeline_response, None, {}) # type: ignore
|
|
839
950
|
|
|
840
|
-
@
|
|
841
|
-
def
|
|
842
|
-
self,
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
951
|
+
@distributed_trace
|
|
952
|
+
def get(
|
|
953
|
+
self, subscription_id: str, resource_group_name: str, workspace_name: str, job_id: str, **kwargs: Any
|
|
954
|
+
) -> _models.JobDetails:
|
|
955
|
+
"""Get job by its id.
|
|
956
|
+
|
|
957
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
958
|
+
:type subscription_id: str
|
|
959
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
960
|
+
:type resource_group_name: str
|
|
961
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
962
|
+
:type workspace_name: str
|
|
851
963
|
:param job_id: Id of the job. Required.
|
|
852
964
|
:type job_id: str
|
|
853
|
-
:
|
|
854
|
-
:
|
|
855
|
-
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
856
|
-
Default value is "application/json".
|
|
857
|
-
:paramtype content_type: str
|
|
858
|
-
:return: JobDetails or None
|
|
859
|
-
:rtype: ~azure.quantum._client.models.JobDetails or None
|
|
965
|
+
:return: JobDetails. The JobDetails is compatible with MutableMapping
|
|
966
|
+
:rtype: ~azure.quantum.models.JobDetails
|
|
860
967
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
861
968
|
"""
|
|
862
|
-
|
|
863
|
-
@overload
|
|
864
|
-
def patch(
|
|
865
|
-
self, job_id: str, patch_job: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
|
|
866
|
-
) -> Optional[_models.JobDetails]:
|
|
867
|
-
"""Patch a job.
|
|
868
|
-
|
|
869
|
-
:param job_id: Id of the job. Required.
|
|
870
|
-
:type job_id: str
|
|
871
|
-
:param patch_job: The json patch document containing the patch operations. Required.
|
|
872
|
-
:type patch_job: IO[bytes]
|
|
873
|
-
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
874
|
-
Default value is "application/json".
|
|
875
|
-
:paramtype content_type: str
|
|
876
|
-
:return: JobDetails or None
|
|
877
|
-
:rtype: ~azure.quantum._client.models.JobDetails or None
|
|
878
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
879
|
-
"""
|
|
880
|
-
|
|
881
|
-
@distributed_trace
|
|
882
|
-
def patch(
|
|
883
|
-
self, job_id: str, patch_job: Union[List[_models.JsonPatchDocument], IO[bytes]], **kwargs: Any
|
|
884
|
-
) -> Optional[_models.JobDetails]:
|
|
885
|
-
"""Patch a job.
|
|
886
|
-
|
|
887
|
-
:param job_id: Id of the job. Required.
|
|
888
|
-
:type job_id: str
|
|
889
|
-
:param patch_job: The json patch document containing the patch operations. Is either a
|
|
890
|
-
[JsonPatchDocument] type or a IO[bytes] type. Required.
|
|
891
|
-
:type patch_job: list[~azure.quantum._client.models.JsonPatchDocument] or IO[bytes]
|
|
892
|
-
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
|
893
|
-
Default value is None.
|
|
894
|
-
:paramtype content_type: str
|
|
895
|
-
:return: JobDetails or None
|
|
896
|
-
:rtype: ~azure.quantum._client.models.JobDetails or None
|
|
897
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
898
|
-
"""
|
|
899
|
-
error_map = {
|
|
969
|
+
error_map: MutableMapping = {
|
|
900
970
|
401: ClientAuthenticationError,
|
|
901
971
|
404: ResourceNotFoundError,
|
|
902
972
|
409: ResourceExistsError,
|
|
@@ -904,96 +974,93 @@ class JobsOperations:
|
|
|
904
974
|
}
|
|
905
975
|
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
906
976
|
|
|
907
|
-
_headers =
|
|
977
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
908
978
|
_params = kwargs.pop("params", {}) or {}
|
|
909
979
|
|
|
910
|
-
|
|
911
|
-
cls: ClsType[Optional[_models.JobDetails]] = kwargs.pop("cls", None)
|
|
912
|
-
|
|
913
|
-
content_type = content_type or "application/json"
|
|
914
|
-
_json = None
|
|
915
|
-
_content = None
|
|
916
|
-
if isinstance(patch_job, (IOBase, bytes)):
|
|
917
|
-
_content = patch_job
|
|
918
|
-
else:
|
|
919
|
-
_json = self._serialize.body(patch_job, "[JsonPatchDocument]")
|
|
980
|
+
cls: ClsType[_models.JobDetails] = kwargs.pop("cls", None)
|
|
920
981
|
|
|
921
|
-
_request =
|
|
982
|
+
_request = build_jobs_get_request(
|
|
983
|
+
subscription_id=subscription_id,
|
|
984
|
+
resource_group_name=resource_group_name,
|
|
985
|
+
workspace_name=workspace_name,
|
|
922
986
|
job_id=job_id,
|
|
923
|
-
subscription_id=self._config.subscription_id,
|
|
924
|
-
resource_group_name=self._config.resource_group_name,
|
|
925
|
-
workspace_name=self._config.workspace_name,
|
|
926
|
-
content_type=content_type,
|
|
927
987
|
api_version=self._config.api_version,
|
|
928
|
-
json=_json,
|
|
929
|
-
content=_content,
|
|
930
988
|
headers=_headers,
|
|
931
989
|
params=_params,
|
|
932
990
|
)
|
|
933
991
|
path_format_arguments = {
|
|
934
|
-
"
|
|
935
|
-
|
|
992
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
993
|
+
"serviceBaseUrl": self._serialize.url(
|
|
994
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
936
995
|
),
|
|
937
996
|
}
|
|
938
997
|
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
939
998
|
|
|
940
|
-
_stream = False
|
|
999
|
+
_stream = kwargs.pop("stream", False)
|
|
941
1000
|
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
942
1001
|
_request, stream=_stream, **kwargs
|
|
943
1002
|
)
|
|
944
1003
|
|
|
945
1004
|
response = pipeline_response.http_response
|
|
946
1005
|
|
|
947
|
-
if response.status_code not in [200
|
|
1006
|
+
if response.status_code not in [200]:
|
|
948
1007
|
if _stream:
|
|
949
|
-
|
|
1008
|
+
try:
|
|
1009
|
+
response.read() # Load the body in memory and close the socket
|
|
1010
|
+
except (StreamConsumedError, StreamClosedError):
|
|
1011
|
+
pass
|
|
950
1012
|
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
951
|
-
|
|
952
|
-
raise HttpResponseError(response=response, model=error)
|
|
1013
|
+
raise HttpResponseError(response=response)
|
|
953
1014
|
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
1015
|
+
if _stream:
|
|
1016
|
+
deserialized = response.iter_bytes()
|
|
1017
|
+
else:
|
|
1018
|
+
deserialized = _deserialize(_models.JobDetails, response.json())
|
|
957
1019
|
|
|
958
1020
|
if cls:
|
|
959
1021
|
return cls(pipeline_response, deserialized, {}) # type: ignore
|
|
960
1022
|
|
|
961
1023
|
return deserialized # type: ignore
|
|
962
1024
|
|
|
963
|
-
|
|
964
|
-
class ProvidersOperations:
|
|
965
|
-
"""
|
|
966
|
-
.. warning::
|
|
967
|
-
**DO NOT** instantiate this class directly.
|
|
968
|
-
|
|
969
|
-
Instead, you should access the following operations through
|
|
970
|
-
:class:`~azure.quantum._client.QuantumClient`'s
|
|
971
|
-
:attr:`providers` attribute.
|
|
972
|
-
"""
|
|
973
|
-
|
|
974
|
-
models = _models
|
|
975
|
-
|
|
976
|
-
def __init__(self, *args, **kwargs):
|
|
977
|
-
input_args = list(args)
|
|
978
|
-
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
|
|
979
|
-
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
|
|
980
|
-
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
|
|
981
|
-
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
|
|
982
|
-
|
|
983
1025
|
@distributed_trace
|
|
984
|
-
def
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
:
|
|
988
|
-
:
|
|
1026
|
+
def list(
|
|
1027
|
+
self,
|
|
1028
|
+
subscription_id: str,
|
|
1029
|
+
resource_group_name: str,
|
|
1030
|
+
workspace_name: str,
|
|
1031
|
+
*,
|
|
1032
|
+
filter: Optional[str] = None,
|
|
1033
|
+
skip: Optional[int] = None,
|
|
1034
|
+
top: Optional[int] = None,
|
|
1035
|
+
orderby: Optional[str] = None,
|
|
1036
|
+
**kwargs: Any
|
|
1037
|
+
) -> Iterable["_models.JobDetails"]:
|
|
1038
|
+
"""List all jobs.
|
|
1039
|
+
|
|
1040
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
1041
|
+
:type subscription_id: str
|
|
1042
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
1043
|
+
:type resource_group_name: str
|
|
1044
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
1045
|
+
:type workspace_name: str
|
|
1046
|
+
:keyword filter: Filter the result list using the given expression. Default value is None.
|
|
1047
|
+
:paramtype filter: str
|
|
1048
|
+
:keyword skip: The number of result items to skip. Default value is None.
|
|
1049
|
+
:paramtype skip: int
|
|
1050
|
+
:keyword top: The number of jobs taken. Default value is None.
|
|
1051
|
+
:paramtype top: int
|
|
1052
|
+
:keyword orderby: The order of returned items. Default value is None.
|
|
1053
|
+
:paramtype orderby: str
|
|
1054
|
+
:return: An iterator like instance of JobDetails
|
|
1055
|
+
:rtype: ~azure.core.paging.ItemPaged[~azure.quantum.models.JobDetails]
|
|
989
1056
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
990
1057
|
"""
|
|
991
1058
|
_headers = kwargs.pop("headers", {}) or {}
|
|
992
1059
|
_params = kwargs.pop("params", {}) or {}
|
|
993
1060
|
|
|
994
|
-
cls: ClsType[_models.
|
|
1061
|
+
cls: ClsType[List[_models.JobDetails]] = kwargs.pop("cls", None)
|
|
995
1062
|
|
|
996
|
-
error_map = {
|
|
1063
|
+
error_map: MutableMapping = {
|
|
997
1064
|
401: ClientAuthenticationError,
|
|
998
1065
|
404: ResourceNotFoundError,
|
|
999
1066
|
409: ResourceExistsError,
|
|
@@ -1004,17 +1071,22 @@ class ProvidersOperations:
|
|
|
1004
1071
|
def prepare_request(next_link=None):
|
|
1005
1072
|
if not next_link:
|
|
1006
1073
|
|
|
1007
|
-
_request =
|
|
1008
|
-
subscription_id=
|
|
1009
|
-
resource_group_name=
|
|
1010
|
-
workspace_name=
|
|
1074
|
+
_request = build_jobs_list_request(
|
|
1075
|
+
subscription_id=subscription_id,
|
|
1076
|
+
resource_group_name=resource_group_name,
|
|
1077
|
+
workspace_name=workspace_name,
|
|
1078
|
+
filter=filter,
|
|
1079
|
+
skip=skip,
|
|
1080
|
+
top=top,
|
|
1081
|
+
orderby=orderby,
|
|
1011
1082
|
api_version=self._config.api_version,
|
|
1012
1083
|
headers=_headers,
|
|
1013
1084
|
params=_params,
|
|
1014
1085
|
)
|
|
1015
1086
|
path_format_arguments = {
|
|
1016
|
-
"
|
|
1017
|
-
|
|
1087
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
1088
|
+
"serviceBaseUrl": self._serialize.url(
|
|
1089
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
1018
1090
|
),
|
|
1019
1091
|
}
|
|
1020
1092
|
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
@@ -1033,8 +1105,9 @@ class ProvidersOperations:
|
|
|
1033
1105
|
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
|
1034
1106
|
)
|
|
1035
1107
|
path_format_arguments = {
|
|
1036
|
-
"
|
|
1037
|
-
|
|
1108
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
1109
|
+
"serviceBaseUrl": self._serialize.url(
|
|
1110
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
1038
1111
|
),
|
|
1039
1112
|
}
|
|
1040
1113
|
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
@@ -1042,13 +1115,11 @@ class ProvidersOperations:
|
|
|
1042
1115
|
return _request
|
|
1043
1116
|
|
|
1044
1117
|
def extract_data(pipeline_response):
|
|
1045
|
-
deserialized =
|
|
1046
|
-
|
|
1047
|
-
)
|
|
1048
|
-
list_of_elem = deserialized.value
|
|
1118
|
+
deserialized = pipeline_response.http_response.json()
|
|
1119
|
+
list_of_elem = _deserialize(List[_models.JobDetails], deserialized["value"])
|
|
1049
1120
|
if cls:
|
|
1050
1121
|
list_of_elem = cls(list_of_elem) # type: ignore
|
|
1051
|
-
return deserialized.
|
|
1122
|
+
return deserialized.get("nextLink") or None, iter(list_of_elem)
|
|
1052
1123
|
|
|
1053
1124
|
def get_next(next_link=None):
|
|
1054
1125
|
_request = prepare_request(next_link)
|
|
@@ -1060,29 +1131,24 @@ class ProvidersOperations:
|
|
|
1060
1131
|
response = pipeline_response.http_response
|
|
1061
1132
|
|
|
1062
1133
|
if response.status_code not in [200]:
|
|
1063
|
-
if _stream:
|
|
1064
|
-
response.read() # Load the body in memory and close the socket
|
|
1065
1134
|
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1066
|
-
|
|
1067
|
-
raise HttpResponseError(response=response, model=error)
|
|
1135
|
+
raise HttpResponseError(response=response)
|
|
1068
1136
|
|
|
1069
1137
|
return pipeline_response
|
|
1070
1138
|
|
|
1071
1139
|
return ItemPaged(get_next, extract_data)
|
|
1072
1140
|
|
|
1073
1141
|
|
|
1074
|
-
class
|
|
1142
|
+
class SessionsOperations:
|
|
1075
1143
|
"""
|
|
1076
1144
|
.. warning::
|
|
1077
1145
|
**DO NOT** instantiate this class directly.
|
|
1078
1146
|
|
|
1079
1147
|
Instead, you should access the following operations through
|
|
1080
|
-
:class:`~azure.quantum.
|
|
1081
|
-
:attr:`
|
|
1148
|
+
:class:`~azure.quantum.ServicesClient`'s
|
|
1149
|
+
:attr:`sessions` attribute.
|
|
1082
1150
|
"""
|
|
1083
1151
|
|
|
1084
|
-
models = _models
|
|
1085
|
-
|
|
1086
1152
|
def __init__(self, *args, **kwargs):
|
|
1087
1153
|
input_args = list(args)
|
|
1088
1154
|
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
|
|
@@ -1091,57 +1157,129 @@ class StorageOperations:
|
|
|
1091
1157
|
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
|
|
1092
1158
|
|
|
1093
1159
|
@overload
|
|
1094
|
-
def
|
|
1095
|
-
self,
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
:
|
|
1101
|
-
|
|
1102
|
-
:
|
|
1160
|
+
def create_or_replace(
|
|
1161
|
+
self,
|
|
1162
|
+
subscription_id: str,
|
|
1163
|
+
resource_group_name: str,
|
|
1164
|
+
workspace_name: str,
|
|
1165
|
+
session_id: str,
|
|
1166
|
+
resource: _models.SessionDetails,
|
|
1167
|
+
*,
|
|
1168
|
+
content_type: str = "application/json",
|
|
1169
|
+
**kwargs: Any
|
|
1170
|
+
) -> _models.SessionDetails:
|
|
1171
|
+
"""Open a new session.
|
|
1172
|
+
|
|
1173
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
1174
|
+
:type subscription_id: str
|
|
1175
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
1176
|
+
:type resource_group_name: str
|
|
1177
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
1178
|
+
:type workspace_name: str
|
|
1179
|
+
:param session_id: Id of the session. Required.
|
|
1180
|
+
:type session_id: str
|
|
1181
|
+
:param resource: The resource instance. Required.
|
|
1182
|
+
:type resource: ~azure.quantum.models.SessionDetails
|
|
1103
1183
|
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
1104
1184
|
Default value is "application/json".
|
|
1105
1185
|
:paramtype content_type: str
|
|
1106
|
-
:return:
|
|
1107
|
-
:rtype: ~azure.quantum.
|
|
1186
|
+
:return: SessionDetails. The SessionDetails is compatible with MutableMapping
|
|
1187
|
+
:rtype: ~azure.quantum.models.SessionDetails
|
|
1108
1188
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1109
1189
|
"""
|
|
1110
1190
|
|
|
1111
1191
|
@overload
|
|
1112
|
-
def
|
|
1113
|
-
self,
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1192
|
+
def create_or_replace(
|
|
1193
|
+
self,
|
|
1194
|
+
subscription_id: str,
|
|
1195
|
+
resource_group_name: str,
|
|
1196
|
+
workspace_name: str,
|
|
1197
|
+
session_id: str,
|
|
1198
|
+
resource: JSON,
|
|
1199
|
+
*,
|
|
1200
|
+
content_type: str = "application/json",
|
|
1201
|
+
**kwargs: Any
|
|
1202
|
+
) -> _models.SessionDetails:
|
|
1203
|
+
"""Open a new session.
|
|
1204
|
+
|
|
1205
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
1206
|
+
:type subscription_id: str
|
|
1207
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
1208
|
+
:type resource_group_name: str
|
|
1209
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
1210
|
+
:type workspace_name: str
|
|
1211
|
+
:param session_id: Id of the session. Required.
|
|
1212
|
+
:type session_id: str
|
|
1213
|
+
:param resource: The resource instance. Required.
|
|
1214
|
+
:type resource: JSON
|
|
1215
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
1216
|
+
Default value is "application/json".
|
|
1217
|
+
:paramtype content_type: str
|
|
1218
|
+
:return: SessionDetails. The SessionDetails is compatible with MutableMapping
|
|
1219
|
+
:rtype: ~azure.quantum.models.SessionDetails
|
|
1220
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1221
|
+
"""
|
|
1117
1222
|
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1223
|
+
@overload
|
|
1224
|
+
def create_or_replace(
|
|
1225
|
+
self,
|
|
1226
|
+
subscription_id: str,
|
|
1227
|
+
resource_group_name: str,
|
|
1228
|
+
workspace_name: str,
|
|
1229
|
+
session_id: str,
|
|
1230
|
+
resource: IO[bytes],
|
|
1231
|
+
*,
|
|
1232
|
+
content_type: str = "application/json",
|
|
1233
|
+
**kwargs: Any
|
|
1234
|
+
) -> _models.SessionDetails:
|
|
1235
|
+
"""Open a new session.
|
|
1236
|
+
|
|
1237
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
1238
|
+
:type subscription_id: str
|
|
1239
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
1240
|
+
:type resource_group_name: str
|
|
1241
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
1242
|
+
:type workspace_name: str
|
|
1243
|
+
:param session_id: Id of the session. Required.
|
|
1244
|
+
:type session_id: str
|
|
1245
|
+
:param resource: The resource instance. Required.
|
|
1246
|
+
:type resource: IO[bytes]
|
|
1121
1247
|
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
1122
1248
|
Default value is "application/json".
|
|
1123
1249
|
:paramtype content_type: str
|
|
1124
|
-
:return:
|
|
1125
|
-
:rtype: ~azure.quantum.
|
|
1250
|
+
:return: SessionDetails. The SessionDetails is compatible with MutableMapping
|
|
1251
|
+
:rtype: ~azure.quantum.models.SessionDetails
|
|
1126
1252
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1127
1253
|
"""
|
|
1128
1254
|
|
|
1129
1255
|
@distributed_trace
|
|
1130
|
-
def
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
:
|
|
1135
|
-
|
|
1136
|
-
:
|
|
1137
|
-
:
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
:
|
|
1256
|
+
def create_or_replace(
|
|
1257
|
+
self,
|
|
1258
|
+
subscription_id: str,
|
|
1259
|
+
resource_group_name: str,
|
|
1260
|
+
workspace_name: str,
|
|
1261
|
+
session_id: str,
|
|
1262
|
+
resource: Union[_models.SessionDetails, JSON, IO[bytes]],
|
|
1263
|
+
**kwargs: Any
|
|
1264
|
+
) -> _models.SessionDetails:
|
|
1265
|
+
"""Open a new session.
|
|
1266
|
+
|
|
1267
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
1268
|
+
:type subscription_id: str
|
|
1269
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
1270
|
+
:type resource_group_name: str
|
|
1271
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
1272
|
+
:type workspace_name: str
|
|
1273
|
+
:param session_id: Id of the session. Required.
|
|
1274
|
+
:type session_id: str
|
|
1275
|
+
:param resource: The resource instance. Is one of the following types: SessionDetails, JSON,
|
|
1276
|
+
IO[bytes] Required.
|
|
1277
|
+
:type resource: ~azure.quantum.models.SessionDetails or JSON or IO[bytes]
|
|
1278
|
+
:return: SessionDetails. The SessionDetails is compatible with MutableMapping
|
|
1279
|
+
:rtype: ~azure.quantum.models.SessionDetails
|
|
1142
1280
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1143
1281
|
"""
|
|
1144
|
-
error_map = {
|
|
1282
|
+
error_map: MutableMapping = {
|
|
1145
1283
|
401: ClientAuthenticationError,
|
|
1146
1284
|
404: ResourceNotFoundError,
|
|
1147
1285
|
409: ResourceExistsError,
|
|
@@ -1153,89 +1291,247 @@ class StorageOperations:
|
|
|
1153
1291
|
_params = kwargs.pop("params", {}) or {}
|
|
1154
1292
|
|
|
1155
1293
|
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
1156
|
-
cls: ClsType[_models.
|
|
1294
|
+
cls: ClsType[_models.SessionDetails] = kwargs.pop("cls", None)
|
|
1157
1295
|
|
|
1158
1296
|
content_type = content_type or "application/json"
|
|
1159
|
-
_json = None
|
|
1160
1297
|
_content = None
|
|
1161
|
-
if isinstance(
|
|
1162
|
-
_content =
|
|
1298
|
+
if isinstance(resource, (IOBase, bytes)):
|
|
1299
|
+
_content = resource
|
|
1163
1300
|
else:
|
|
1164
|
-
|
|
1301
|
+
_content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore
|
|
1165
1302
|
|
|
1166
|
-
_request =
|
|
1167
|
-
subscription_id=
|
|
1168
|
-
resource_group_name=
|
|
1169
|
-
workspace_name=
|
|
1303
|
+
_request = build_sessions_create_or_replace_request(
|
|
1304
|
+
subscription_id=subscription_id,
|
|
1305
|
+
resource_group_name=resource_group_name,
|
|
1306
|
+
workspace_name=workspace_name,
|
|
1307
|
+
session_id=session_id,
|
|
1170
1308
|
content_type=content_type,
|
|
1171
1309
|
api_version=self._config.api_version,
|
|
1172
|
-
json=_json,
|
|
1173
1310
|
content=_content,
|
|
1174
1311
|
headers=_headers,
|
|
1175
1312
|
params=_params,
|
|
1176
1313
|
)
|
|
1177
1314
|
path_format_arguments = {
|
|
1178
|
-
"
|
|
1179
|
-
|
|
1315
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
1316
|
+
"serviceBaseUrl": self._serialize.url(
|
|
1317
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
1180
1318
|
),
|
|
1181
1319
|
}
|
|
1182
1320
|
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1183
1321
|
|
|
1184
|
-
_stream = False
|
|
1322
|
+
_stream = kwargs.pop("stream", False)
|
|
1185
1323
|
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
1186
1324
|
_request, stream=_stream, **kwargs
|
|
1187
1325
|
)
|
|
1188
1326
|
|
|
1189
1327
|
response = pipeline_response.http_response
|
|
1190
1328
|
|
|
1191
|
-
if response.status_code not in [200]:
|
|
1329
|
+
if response.status_code not in [200, 201]:
|
|
1192
1330
|
if _stream:
|
|
1193
|
-
|
|
1331
|
+
try:
|
|
1332
|
+
response.read() # Load the body in memory and close the socket
|
|
1333
|
+
except (StreamConsumedError, StreamClosedError):
|
|
1334
|
+
pass
|
|
1194
1335
|
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1195
|
-
|
|
1196
|
-
raise HttpResponseError(response=response, model=error)
|
|
1336
|
+
raise HttpResponseError(response=response)
|
|
1197
1337
|
|
|
1198
|
-
|
|
1338
|
+
if _stream:
|
|
1339
|
+
deserialized = response.iter_bytes()
|
|
1340
|
+
else:
|
|
1341
|
+
deserialized = _deserialize(_models.SessionDetails, response.json())
|
|
1199
1342
|
|
|
1200
1343
|
if cls:
|
|
1201
1344
|
return cls(pipeline_response, deserialized, {}) # type: ignore
|
|
1202
1345
|
|
|
1203
1346
|
return deserialized # type: ignore
|
|
1204
1347
|
|
|
1348
|
+
@distributed_trace
|
|
1349
|
+
def close(
|
|
1350
|
+
self, subscription_id: str, resource_group_name: str, workspace_name: str, session_id: str, **kwargs: Any
|
|
1351
|
+
) -> _models.SessionDetails:
|
|
1352
|
+
"""Close an existing session.
|
|
1353
|
+
|
|
1354
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
1355
|
+
:type subscription_id: str
|
|
1356
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
1357
|
+
:type resource_group_name: str
|
|
1358
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
1359
|
+
:type workspace_name: str
|
|
1360
|
+
:param session_id: Id of the session. Required.
|
|
1361
|
+
:type session_id: str
|
|
1362
|
+
:return: SessionDetails. The SessionDetails is compatible with MutableMapping
|
|
1363
|
+
:rtype: ~azure.quantum.models.SessionDetails
|
|
1364
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1365
|
+
"""
|
|
1366
|
+
error_map: MutableMapping = {
|
|
1367
|
+
401: ClientAuthenticationError,
|
|
1368
|
+
404: ResourceNotFoundError,
|
|
1369
|
+
409: ResourceExistsError,
|
|
1370
|
+
304: ResourceNotModifiedError,
|
|
1371
|
+
}
|
|
1372
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
1373
|
+
|
|
1374
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
1375
|
+
_params = kwargs.pop("params", {}) or {}
|
|
1205
1376
|
|
|
1206
|
-
|
|
1207
|
-
"""
|
|
1208
|
-
.. warning::
|
|
1209
|
-
**DO NOT** instantiate this class directly.
|
|
1377
|
+
cls: ClsType[_models.SessionDetails] = kwargs.pop("cls", None)
|
|
1210
1378
|
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1379
|
+
_request = build_sessions_close_request(
|
|
1380
|
+
subscription_id=subscription_id,
|
|
1381
|
+
resource_group_name=resource_group_name,
|
|
1382
|
+
workspace_name=workspace_name,
|
|
1383
|
+
session_id=session_id,
|
|
1384
|
+
api_version=self._config.api_version,
|
|
1385
|
+
headers=_headers,
|
|
1386
|
+
params=_params,
|
|
1387
|
+
)
|
|
1388
|
+
path_format_arguments = {
|
|
1389
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
1390
|
+
"serviceBaseUrl": self._serialize.url(
|
|
1391
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
1392
|
+
),
|
|
1393
|
+
}
|
|
1394
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1215
1395
|
|
|
1216
|
-
|
|
1396
|
+
_stream = kwargs.pop("stream", False)
|
|
1397
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
1398
|
+
_request, stream=_stream, **kwargs
|
|
1399
|
+
)
|
|
1217
1400
|
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1401
|
+
response = pipeline_response.http_response
|
|
1402
|
+
|
|
1403
|
+
if response.status_code not in [200]:
|
|
1404
|
+
if _stream:
|
|
1405
|
+
try:
|
|
1406
|
+
response.read() # Load the body in memory and close the socket
|
|
1407
|
+
except (StreamConsumedError, StreamClosedError):
|
|
1408
|
+
pass
|
|
1409
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1410
|
+
raise HttpResponseError(response=response)
|
|
1411
|
+
|
|
1412
|
+
if _stream:
|
|
1413
|
+
deserialized = response.iter_bytes()
|
|
1414
|
+
else:
|
|
1415
|
+
deserialized = _deserialize(_models.SessionDetails, response.json())
|
|
1416
|
+
|
|
1417
|
+
if cls:
|
|
1418
|
+
return cls(pipeline_response, deserialized, {}) # type: ignore
|
|
1419
|
+
|
|
1420
|
+
return deserialized # type: ignore
|
|
1224
1421
|
|
|
1225
1422
|
@distributed_trace
|
|
1226
|
-
def
|
|
1227
|
-
|
|
1423
|
+
def get(
|
|
1424
|
+
self, subscription_id: str, resource_group_name: str, workspace_name: str, session_id: str, **kwargs: Any
|
|
1425
|
+
) -> _models.SessionDetails:
|
|
1426
|
+
"""Get Session by its id.
|
|
1427
|
+
|
|
1428
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
1429
|
+
:type subscription_id: str
|
|
1430
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
1431
|
+
:type resource_group_name: str
|
|
1432
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
1433
|
+
:type workspace_name: str
|
|
1434
|
+
:param session_id: Id of the session. Required.
|
|
1435
|
+
:type session_id: str
|
|
1436
|
+
:return: SessionDetails. The SessionDetails is compatible with MutableMapping
|
|
1437
|
+
:rtype: ~azure.quantum.models.SessionDetails
|
|
1438
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1439
|
+
"""
|
|
1440
|
+
error_map: MutableMapping = {
|
|
1441
|
+
401: ClientAuthenticationError,
|
|
1442
|
+
404: ResourceNotFoundError,
|
|
1443
|
+
409: ResourceExistsError,
|
|
1444
|
+
304: ResourceNotModifiedError,
|
|
1445
|
+
}
|
|
1446
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
1228
1447
|
|
|
1229
|
-
|
|
1230
|
-
|
|
1448
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
1449
|
+
_params = kwargs.pop("params", {}) or {}
|
|
1450
|
+
|
|
1451
|
+
cls: ClsType[_models.SessionDetails] = kwargs.pop("cls", None)
|
|
1452
|
+
|
|
1453
|
+
_request = build_sessions_get_request(
|
|
1454
|
+
subscription_id=subscription_id,
|
|
1455
|
+
resource_group_name=resource_group_name,
|
|
1456
|
+
workspace_name=workspace_name,
|
|
1457
|
+
session_id=session_id,
|
|
1458
|
+
api_version=self._config.api_version,
|
|
1459
|
+
headers=_headers,
|
|
1460
|
+
params=_params,
|
|
1461
|
+
)
|
|
1462
|
+
path_format_arguments = {
|
|
1463
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
1464
|
+
"serviceBaseUrl": self._serialize.url(
|
|
1465
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
1466
|
+
),
|
|
1467
|
+
}
|
|
1468
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1469
|
+
|
|
1470
|
+
_stream = kwargs.pop("stream", False)
|
|
1471
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
1472
|
+
_request, stream=_stream, **kwargs
|
|
1473
|
+
)
|
|
1474
|
+
|
|
1475
|
+
response = pipeline_response.http_response
|
|
1476
|
+
|
|
1477
|
+
if response.status_code not in [200]:
|
|
1478
|
+
if _stream:
|
|
1479
|
+
try:
|
|
1480
|
+
response.read() # Load the body in memory and close the socket
|
|
1481
|
+
except (StreamConsumedError, StreamClosedError):
|
|
1482
|
+
pass
|
|
1483
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1484
|
+
raise HttpResponseError(response=response)
|
|
1485
|
+
|
|
1486
|
+
if _stream:
|
|
1487
|
+
deserialized = response.iter_bytes()
|
|
1488
|
+
else:
|
|
1489
|
+
deserialized = _deserialize(_models.SessionDetails, response.json())
|
|
1490
|
+
|
|
1491
|
+
if cls:
|
|
1492
|
+
return cls(pipeline_response, deserialized, {}) # type: ignore
|
|
1493
|
+
|
|
1494
|
+
return deserialized # type: ignore
|
|
1495
|
+
|
|
1496
|
+
@distributed_trace
|
|
1497
|
+
def list(
|
|
1498
|
+
self,
|
|
1499
|
+
subscription_id: str,
|
|
1500
|
+
resource_group_name: str,
|
|
1501
|
+
workspace_name: str,
|
|
1502
|
+
*,
|
|
1503
|
+
filter: Optional[str] = None,
|
|
1504
|
+
skip: Optional[int] = None,
|
|
1505
|
+
top: Optional[int] = None,
|
|
1506
|
+
orderby: Optional[str] = None,
|
|
1507
|
+
**kwargs: Any
|
|
1508
|
+
) -> Iterable["_models.SessionDetails"]:
|
|
1509
|
+
"""List all Sessions.
|
|
1510
|
+
|
|
1511
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
1512
|
+
:type subscription_id: str
|
|
1513
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
1514
|
+
:type resource_group_name: str
|
|
1515
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
1516
|
+
:type workspace_name: str
|
|
1517
|
+
:keyword filter: Filter the result list using the given expression. Default value is None.
|
|
1518
|
+
:paramtype filter: str
|
|
1519
|
+
:keyword skip: The number of result items to skip. Default value is None.
|
|
1520
|
+
:paramtype skip: int
|
|
1521
|
+
:keyword top: The number of jobs taken. Default value is None.
|
|
1522
|
+
:paramtype top: int
|
|
1523
|
+
:keyword orderby: The order of returned items. Default value is None.
|
|
1524
|
+
:paramtype orderby: str
|
|
1525
|
+
:return: An iterator like instance of SessionDetails
|
|
1526
|
+
:rtype: ~azure.core.paging.ItemPaged[~azure.quantum.models.SessionDetails]
|
|
1231
1527
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1232
1528
|
"""
|
|
1233
1529
|
_headers = kwargs.pop("headers", {}) or {}
|
|
1234
1530
|
_params = kwargs.pop("params", {}) or {}
|
|
1235
1531
|
|
|
1236
|
-
cls: ClsType[_models.
|
|
1532
|
+
cls: ClsType[List[_models.SessionDetails]] = kwargs.pop("cls", None)
|
|
1237
1533
|
|
|
1238
|
-
error_map = {
|
|
1534
|
+
error_map: MutableMapping = {
|
|
1239
1535
|
401: ClientAuthenticationError,
|
|
1240
1536
|
404: ResourceNotFoundError,
|
|
1241
1537
|
409: ResourceExistsError,
|
|
@@ -1246,17 +1542,22 @@ class QuotasOperations:
|
|
|
1246
1542
|
def prepare_request(next_link=None):
|
|
1247
1543
|
if not next_link:
|
|
1248
1544
|
|
|
1249
|
-
_request =
|
|
1250
|
-
subscription_id=
|
|
1251
|
-
resource_group_name=
|
|
1252
|
-
workspace_name=
|
|
1545
|
+
_request = build_sessions_list_request(
|
|
1546
|
+
subscription_id=subscription_id,
|
|
1547
|
+
resource_group_name=resource_group_name,
|
|
1548
|
+
workspace_name=workspace_name,
|
|
1549
|
+
filter=filter,
|
|
1550
|
+
skip=skip,
|
|
1551
|
+
top=top,
|
|
1552
|
+
orderby=orderby,
|
|
1253
1553
|
api_version=self._config.api_version,
|
|
1254
1554
|
headers=_headers,
|
|
1255
1555
|
params=_params,
|
|
1256
1556
|
)
|
|
1257
1557
|
path_format_arguments = {
|
|
1258
|
-
"
|
|
1259
|
-
|
|
1558
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
1559
|
+
"serviceBaseUrl": self._serialize.url(
|
|
1560
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
1260
1561
|
),
|
|
1261
1562
|
}
|
|
1262
1563
|
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
@@ -1275,8 +1576,9 @@ class QuotasOperations:
|
|
|
1275
1576
|
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
|
1276
1577
|
)
|
|
1277
1578
|
path_format_arguments = {
|
|
1278
|
-
"
|
|
1279
|
-
|
|
1579
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
1580
|
+
"serviceBaseUrl": self._serialize.url(
|
|
1581
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
1280
1582
|
),
|
|
1281
1583
|
}
|
|
1282
1584
|
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
@@ -1284,13 +1586,131 @@ class QuotasOperations:
|
|
|
1284
1586
|
return _request
|
|
1285
1587
|
|
|
1286
1588
|
def extract_data(pipeline_response):
|
|
1287
|
-
deserialized =
|
|
1288
|
-
|
|
1589
|
+
deserialized = pipeline_response.http_response.json()
|
|
1590
|
+
list_of_elem = _deserialize(List[_models.SessionDetails], deserialized["value"])
|
|
1591
|
+
if cls:
|
|
1592
|
+
list_of_elem = cls(list_of_elem) # type: ignore
|
|
1593
|
+
return deserialized.get("nextLink") or None, iter(list_of_elem)
|
|
1594
|
+
|
|
1595
|
+
def get_next(next_link=None):
|
|
1596
|
+
_request = prepare_request(next_link)
|
|
1597
|
+
|
|
1598
|
+
_stream = False
|
|
1599
|
+
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
1600
|
+
_request, stream=_stream, **kwargs
|
|
1289
1601
|
)
|
|
1290
|
-
|
|
1602
|
+
response = pipeline_response.http_response
|
|
1603
|
+
|
|
1604
|
+
if response.status_code not in [200]:
|
|
1605
|
+
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1606
|
+
raise HttpResponseError(response=response)
|
|
1607
|
+
|
|
1608
|
+
return pipeline_response
|
|
1609
|
+
|
|
1610
|
+
return ItemPaged(get_next, extract_data)
|
|
1611
|
+
|
|
1612
|
+
@distributed_trace
|
|
1613
|
+
def jobs_list(
|
|
1614
|
+
self,
|
|
1615
|
+
subscription_id: str,
|
|
1616
|
+
resource_group_name: str,
|
|
1617
|
+
workspace_name: str,
|
|
1618
|
+
session_id: str,
|
|
1619
|
+
*,
|
|
1620
|
+
filter: Optional[str] = None,
|
|
1621
|
+
skip: Optional[int] = None,
|
|
1622
|
+
top: Optional[int] = None,
|
|
1623
|
+
orderby: Optional[str] = None,
|
|
1624
|
+
**kwargs: Any
|
|
1625
|
+
) -> Iterable["_models.JobDetails"]:
|
|
1626
|
+
"""List jobs in a session.
|
|
1627
|
+
|
|
1628
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
1629
|
+
:type subscription_id: str
|
|
1630
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
1631
|
+
:type resource_group_name: str
|
|
1632
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
1633
|
+
:type workspace_name: str
|
|
1634
|
+
:param session_id: Id of the session to list jobs from. Required.
|
|
1635
|
+
:type session_id: str
|
|
1636
|
+
:keyword filter: Filter the result list using the given expression. Default value is None.
|
|
1637
|
+
:paramtype filter: str
|
|
1638
|
+
:keyword skip: The number of result items to skip. Default value is None.
|
|
1639
|
+
:paramtype skip: int
|
|
1640
|
+
:keyword top: The number of jobs taken. Default value is None.
|
|
1641
|
+
:paramtype top: int
|
|
1642
|
+
:keyword orderby: The order of returned items. Default value is None.
|
|
1643
|
+
:paramtype orderby: str
|
|
1644
|
+
:return: An iterator like instance of JobDetails
|
|
1645
|
+
:rtype: ~azure.core.paging.ItemPaged[~azure.quantum.models.JobDetails]
|
|
1646
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1647
|
+
"""
|
|
1648
|
+
_headers = kwargs.pop("headers", {}) or {}
|
|
1649
|
+
_params = kwargs.pop("params", {}) or {}
|
|
1650
|
+
|
|
1651
|
+
cls: ClsType[List[_models.JobDetails]] = kwargs.pop("cls", None)
|
|
1652
|
+
|
|
1653
|
+
error_map: MutableMapping = {
|
|
1654
|
+
401: ClientAuthenticationError,
|
|
1655
|
+
404: ResourceNotFoundError,
|
|
1656
|
+
409: ResourceExistsError,
|
|
1657
|
+
304: ResourceNotModifiedError,
|
|
1658
|
+
}
|
|
1659
|
+
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
1660
|
+
|
|
1661
|
+
def prepare_request(next_link=None):
|
|
1662
|
+
if not next_link:
|
|
1663
|
+
|
|
1664
|
+
_request = build_sessions_jobs_list_request(
|
|
1665
|
+
subscription_id=subscription_id,
|
|
1666
|
+
resource_group_name=resource_group_name,
|
|
1667
|
+
workspace_name=workspace_name,
|
|
1668
|
+
session_id=session_id,
|
|
1669
|
+
filter=filter,
|
|
1670
|
+
skip=skip,
|
|
1671
|
+
top=top,
|
|
1672
|
+
orderby=orderby,
|
|
1673
|
+
api_version=self._config.api_version,
|
|
1674
|
+
headers=_headers,
|
|
1675
|
+
params=_params,
|
|
1676
|
+
)
|
|
1677
|
+
path_format_arguments = {
|
|
1678
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
1679
|
+
"serviceBaseUrl": self._serialize.url(
|
|
1680
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
1681
|
+
),
|
|
1682
|
+
}
|
|
1683
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1684
|
+
|
|
1685
|
+
else:
|
|
1686
|
+
# make call to next link with the client's api-version
|
|
1687
|
+
_parsed_next_link = urllib.parse.urlparse(next_link)
|
|
1688
|
+
_next_request_params = case_insensitive_dict(
|
|
1689
|
+
{
|
|
1690
|
+
key: [urllib.parse.quote(v) for v in value]
|
|
1691
|
+
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
|
|
1692
|
+
}
|
|
1693
|
+
)
|
|
1694
|
+
_next_request_params["api-version"] = self._config.api_version
|
|
1695
|
+
_request = HttpRequest(
|
|
1696
|
+
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
|
1697
|
+
)
|
|
1698
|
+
path_format_arguments = {
|
|
1699
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
1700
|
+
"serviceBaseUrl": self._serialize.url(
|
|
1701
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
1702
|
+
),
|
|
1703
|
+
}
|
|
1704
|
+
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1705
|
+
|
|
1706
|
+
return _request
|
|
1707
|
+
|
|
1708
|
+
def extract_data(pipeline_response):
|
|
1709
|
+
deserialized = pipeline_response.http_response.json()
|
|
1710
|
+
list_of_elem = _deserialize(List[_models.JobDetails], deserialized["value"])
|
|
1291
1711
|
if cls:
|
|
1292
1712
|
list_of_elem = cls(list_of_elem) # type: ignore
|
|
1293
|
-
return deserialized.
|
|
1713
|
+
return deserialized.get("nextLink") or None, iter(list_of_elem)
|
|
1294
1714
|
|
|
1295
1715
|
def get_next(next_link=None):
|
|
1296
1716
|
_request = prepare_request(next_link)
|
|
@@ -1302,29 +1722,24 @@ class QuotasOperations:
|
|
|
1302
1722
|
response = pipeline_response.http_response
|
|
1303
1723
|
|
|
1304
1724
|
if response.status_code not in [200]:
|
|
1305
|
-
if _stream:
|
|
1306
|
-
response.read() # Load the body in memory and close the socket
|
|
1307
1725
|
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1308
|
-
|
|
1309
|
-
raise HttpResponseError(response=response, model=error)
|
|
1726
|
+
raise HttpResponseError(response=response)
|
|
1310
1727
|
|
|
1311
1728
|
return pipeline_response
|
|
1312
1729
|
|
|
1313
1730
|
return ItemPaged(get_next, extract_data)
|
|
1314
1731
|
|
|
1315
1732
|
|
|
1316
|
-
class
|
|
1733
|
+
class ProvidersOperations:
|
|
1317
1734
|
"""
|
|
1318
1735
|
.. warning::
|
|
1319
1736
|
**DO NOT** instantiate this class directly.
|
|
1320
1737
|
|
|
1321
1738
|
Instead, you should access the following operations through
|
|
1322
|
-
:class:`~azure.quantum.
|
|
1323
|
-
:attr:`
|
|
1739
|
+
:class:`~azure.quantum.ServicesClient`'s
|
|
1740
|
+
:attr:`providers` attribute.
|
|
1324
1741
|
"""
|
|
1325
1742
|
|
|
1326
|
-
models = _models
|
|
1327
|
-
|
|
1328
1743
|
def __init__(self, *args, **kwargs):
|
|
1329
1744
|
input_args = list(args)
|
|
1330
1745
|
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
|
|
@@ -1333,19 +1748,27 @@ class SessionsOperations:
|
|
|
1333
1748
|
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
|
|
1334
1749
|
|
|
1335
1750
|
@distributed_trace
|
|
1336
|
-
def list(
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1751
|
+
def list(
|
|
1752
|
+
self, subscription_id: str, resource_group_name: str, workspace_name: str, **kwargs: Any
|
|
1753
|
+
) -> Iterable["_models.ProviderStatus"]:
|
|
1754
|
+
"""List all providers in the workspace with their respective status.
|
|
1755
|
+
|
|
1756
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
1757
|
+
:type subscription_id: str
|
|
1758
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
1759
|
+
:type resource_group_name: str
|
|
1760
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
1761
|
+
:type workspace_name: str
|
|
1762
|
+
:return: An iterator like instance of ProviderStatus
|
|
1763
|
+
:rtype: ~azure.core.paging.ItemPaged[~azure.quantum.models.ProviderStatus]
|
|
1341
1764
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1342
1765
|
"""
|
|
1343
1766
|
_headers = kwargs.pop("headers", {}) or {}
|
|
1344
1767
|
_params = kwargs.pop("params", {}) or {}
|
|
1345
1768
|
|
|
1346
|
-
cls: ClsType[_models.
|
|
1769
|
+
cls: ClsType[List[_models.ProviderStatus]] = kwargs.pop("cls", None)
|
|
1347
1770
|
|
|
1348
|
-
error_map = {
|
|
1771
|
+
error_map: MutableMapping = {
|
|
1349
1772
|
401: ClientAuthenticationError,
|
|
1350
1773
|
404: ResourceNotFoundError,
|
|
1351
1774
|
409: ResourceExistsError,
|
|
@@ -1356,17 +1779,18 @@ class SessionsOperations:
|
|
|
1356
1779
|
def prepare_request(next_link=None):
|
|
1357
1780
|
if not next_link:
|
|
1358
1781
|
|
|
1359
|
-
_request =
|
|
1360
|
-
subscription_id=
|
|
1361
|
-
resource_group_name=
|
|
1362
|
-
workspace_name=
|
|
1782
|
+
_request = build_providers_list_request(
|
|
1783
|
+
subscription_id=subscription_id,
|
|
1784
|
+
resource_group_name=resource_group_name,
|
|
1785
|
+
workspace_name=workspace_name,
|
|
1363
1786
|
api_version=self._config.api_version,
|
|
1364
1787
|
headers=_headers,
|
|
1365
1788
|
params=_params,
|
|
1366
1789
|
)
|
|
1367
1790
|
path_format_arguments = {
|
|
1368
|
-
"
|
|
1369
|
-
|
|
1791
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
1792
|
+
"serviceBaseUrl": self._serialize.url(
|
|
1793
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
1370
1794
|
),
|
|
1371
1795
|
}
|
|
1372
1796
|
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
@@ -1385,8 +1809,9 @@ class SessionsOperations:
|
|
|
1385
1809
|
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
|
1386
1810
|
)
|
|
1387
1811
|
path_format_arguments = {
|
|
1388
|
-
"
|
|
1389
|
-
|
|
1812
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
1813
|
+
"serviceBaseUrl": self._serialize.url(
|
|
1814
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
1390
1815
|
),
|
|
1391
1816
|
}
|
|
1392
1817
|
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
@@ -1394,13 +1819,11 @@ class SessionsOperations:
|
|
|
1394
1819
|
return _request
|
|
1395
1820
|
|
|
1396
1821
|
def extract_data(pipeline_response):
|
|
1397
|
-
deserialized =
|
|
1398
|
-
|
|
1399
|
-
)
|
|
1400
|
-
list_of_elem = deserialized.value
|
|
1822
|
+
deserialized = pipeline_response.http_response.json()
|
|
1823
|
+
list_of_elem = _deserialize(List[_models.ProviderStatus], deserialized["value"])
|
|
1401
1824
|
if cls:
|
|
1402
1825
|
list_of_elem = cls(list_of_elem) # type: ignore
|
|
1403
|
-
return deserialized.
|
|
1826
|
+
return deserialized.get("nextLink") or None, iter(list_of_elem)
|
|
1404
1827
|
|
|
1405
1828
|
def get_next(next_link=None):
|
|
1406
1829
|
_request = prepare_request(next_link)
|
|
@@ -1412,131 +1835,147 @@ class SessionsOperations:
|
|
|
1412
1835
|
response = pipeline_response.http_response
|
|
1413
1836
|
|
|
1414
1837
|
if response.status_code not in [200]:
|
|
1415
|
-
if _stream:
|
|
1416
|
-
response.read() # Load the body in memory and close the socket
|
|
1417
1838
|
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1418
|
-
|
|
1419
|
-
raise HttpResponseError(response=response, model=error)
|
|
1839
|
+
raise HttpResponseError(response=response)
|
|
1420
1840
|
|
|
1421
1841
|
return pipeline_response
|
|
1422
1842
|
|
|
1423
1843
|
return ItemPaged(get_next, extract_data)
|
|
1424
1844
|
|
|
1425
|
-
@distributed_trace
|
|
1426
|
-
def get(self, session_id: str, **kwargs: Any) -> _models.SessionDetails:
|
|
1427
|
-
"""Get session by id.
|
|
1428
|
-
|
|
1429
|
-
:param session_id: Id of the session. Required.
|
|
1430
|
-
:type session_id: str
|
|
1431
|
-
:return: SessionDetails
|
|
1432
|
-
:rtype: ~azure.quantum._client.models.SessionDetails
|
|
1433
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1434
|
-
"""
|
|
1435
|
-
error_map = {
|
|
1436
|
-
401: ClientAuthenticationError,
|
|
1437
|
-
404: ResourceNotFoundError,
|
|
1438
|
-
409: ResourceExistsError,
|
|
1439
|
-
304: ResourceNotModifiedError,
|
|
1440
|
-
}
|
|
1441
|
-
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
1442
|
-
|
|
1443
|
-
_headers = kwargs.pop("headers", {}) or {}
|
|
1444
|
-
_params = kwargs.pop("params", {}) or {}
|
|
1445
|
-
|
|
1446
|
-
cls: ClsType[_models.SessionDetails] = kwargs.pop("cls", None)
|
|
1447
|
-
|
|
1448
|
-
_request = build_sessions_get_request(
|
|
1449
|
-
session_id=session_id,
|
|
1450
|
-
subscription_id=self._config.subscription_id,
|
|
1451
|
-
resource_group_name=self._config.resource_group_name,
|
|
1452
|
-
workspace_name=self._config.workspace_name,
|
|
1453
|
-
api_version=self._config.api_version,
|
|
1454
|
-
headers=_headers,
|
|
1455
|
-
params=_params,
|
|
1456
|
-
)
|
|
1457
|
-
path_format_arguments = {
|
|
1458
|
-
"azureRegion": self._serialize.url(
|
|
1459
|
-
"self._config.azure_region", self._config.azure_region, "str", skip_quote=True
|
|
1460
|
-
),
|
|
1461
|
-
}
|
|
1462
|
-
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1463
|
-
|
|
1464
|
-
_stream = False
|
|
1465
|
-
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
1466
|
-
_request, stream=_stream, **kwargs
|
|
1467
|
-
)
|
|
1468
1845
|
|
|
1469
|
-
|
|
1846
|
+
class StorageOperations:
|
|
1847
|
+
"""
|
|
1848
|
+
.. warning::
|
|
1849
|
+
**DO NOT** instantiate this class directly.
|
|
1470
1850
|
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
error = self._deserialize.failsafe_deserialize(_models.RestError, pipeline_response)
|
|
1476
|
-
raise HttpResponseError(response=response, model=error)
|
|
1851
|
+
Instead, you should access the following operations through
|
|
1852
|
+
:class:`~azure.quantum.ServicesClient`'s
|
|
1853
|
+
:attr:`storage` attribute.
|
|
1854
|
+
"""
|
|
1477
1855
|
|
|
1478
|
-
|
|
1856
|
+
def __init__(self, *args, **kwargs):
|
|
1857
|
+
input_args = list(args)
|
|
1858
|
+
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
|
|
1859
|
+
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
|
|
1860
|
+
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
|
|
1861
|
+
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
|
|
1479
1862
|
|
|
1480
|
-
|
|
1481
|
-
|
|
1863
|
+
@overload
|
|
1864
|
+
def get_sas_uri(
|
|
1865
|
+
self,
|
|
1866
|
+
subscription_id: str,
|
|
1867
|
+
resource_group_name: str,
|
|
1868
|
+
workspace_name: str,
|
|
1869
|
+
blob_details: _models.BlobDetails,
|
|
1870
|
+
*,
|
|
1871
|
+
content_type: str = "application/json",
|
|
1872
|
+
**kwargs: Any
|
|
1873
|
+
) -> _models.SasUriResponse:
|
|
1874
|
+
"""Gets a URL with SAS token for a container/blob in the storage account associated with the
|
|
1875
|
+
workspace. The SAS URL can be used to upload job input and/or download job output.
|
|
1482
1876
|
|
|
1483
|
-
|
|
1877
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
1878
|
+
:type subscription_id: str
|
|
1879
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
1880
|
+
:type resource_group_name: str
|
|
1881
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
1882
|
+
:type workspace_name: str
|
|
1883
|
+
:param blob_details: The details (name and container) of the blob. Required.
|
|
1884
|
+
:type blob_details: ~azure.quantum.models.BlobDetails
|
|
1885
|
+
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
1886
|
+
Default value is "application/json".
|
|
1887
|
+
:paramtype content_type: str
|
|
1888
|
+
:return: SasUriResponse. The SasUriResponse is compatible with MutableMapping
|
|
1889
|
+
:rtype: ~azure.quantum.models.SasUriResponse
|
|
1890
|
+
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1891
|
+
"""
|
|
1484
1892
|
|
|
1485
1893
|
@overload
|
|
1486
|
-
def
|
|
1487
|
-
self,
|
|
1488
|
-
|
|
1489
|
-
|
|
1894
|
+
def get_sas_uri(
|
|
1895
|
+
self,
|
|
1896
|
+
subscription_id: str,
|
|
1897
|
+
resource_group_name: str,
|
|
1898
|
+
workspace_name: str,
|
|
1899
|
+
blob_details: JSON,
|
|
1900
|
+
*,
|
|
1901
|
+
content_type: str = "application/json",
|
|
1902
|
+
**kwargs: Any
|
|
1903
|
+
) -> _models.SasUriResponse:
|
|
1904
|
+
"""Gets a URL with SAS token for a container/blob in the storage account associated with the
|
|
1905
|
+
workspace. The SAS URL can be used to upload job input and/or download job output.
|
|
1490
1906
|
|
|
1491
|
-
:param
|
|
1492
|
-
:type
|
|
1493
|
-
:param
|
|
1494
|
-
:type
|
|
1907
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
1908
|
+
:type subscription_id: str
|
|
1909
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
1910
|
+
:type resource_group_name: str
|
|
1911
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
1912
|
+
:type workspace_name: str
|
|
1913
|
+
:param blob_details: The details (name and container) of the blob. Required.
|
|
1914
|
+
:type blob_details: JSON
|
|
1495
1915
|
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
1496
1916
|
Default value is "application/json".
|
|
1497
1917
|
:paramtype content_type: str
|
|
1498
|
-
:return:
|
|
1499
|
-
:rtype: ~azure.quantum.
|
|
1918
|
+
:return: SasUriResponse. The SasUriResponse is compatible with MutableMapping
|
|
1919
|
+
:rtype: ~azure.quantum.models.SasUriResponse
|
|
1500
1920
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1501
1921
|
"""
|
|
1502
1922
|
|
|
1503
1923
|
@overload
|
|
1504
|
-
def
|
|
1505
|
-
self,
|
|
1506
|
-
|
|
1507
|
-
|
|
1924
|
+
def get_sas_uri(
|
|
1925
|
+
self,
|
|
1926
|
+
subscription_id: str,
|
|
1927
|
+
resource_group_name: str,
|
|
1928
|
+
workspace_name: str,
|
|
1929
|
+
blob_details: IO[bytes],
|
|
1930
|
+
*,
|
|
1931
|
+
content_type: str = "application/json",
|
|
1932
|
+
**kwargs: Any
|
|
1933
|
+
) -> _models.SasUriResponse:
|
|
1934
|
+
"""Gets a URL with SAS token for a container/blob in the storage account associated with the
|
|
1935
|
+
workspace. The SAS URL can be used to upload job input and/or download job output.
|
|
1508
1936
|
|
|
1509
|
-
:param
|
|
1510
|
-
:type
|
|
1511
|
-
:param
|
|
1512
|
-
:type
|
|
1937
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
1938
|
+
:type subscription_id: str
|
|
1939
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
1940
|
+
:type resource_group_name: str
|
|
1941
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
1942
|
+
:type workspace_name: str
|
|
1943
|
+
:param blob_details: The details (name and container) of the blob. Required.
|
|
1944
|
+
:type blob_details: IO[bytes]
|
|
1513
1945
|
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
1514
1946
|
Default value is "application/json".
|
|
1515
1947
|
:paramtype content_type: str
|
|
1516
|
-
:return:
|
|
1517
|
-
:rtype: ~azure.quantum.
|
|
1948
|
+
:return: SasUriResponse. The SasUriResponse is compatible with MutableMapping
|
|
1949
|
+
:rtype: ~azure.quantum.models.SasUriResponse
|
|
1518
1950
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1519
1951
|
"""
|
|
1520
1952
|
|
|
1521
1953
|
@distributed_trace
|
|
1522
|
-
def
|
|
1523
|
-
self,
|
|
1524
|
-
|
|
1525
|
-
|
|
1954
|
+
def get_sas_uri(
|
|
1955
|
+
self,
|
|
1956
|
+
subscription_id: str,
|
|
1957
|
+
resource_group_name: str,
|
|
1958
|
+
workspace_name: str,
|
|
1959
|
+
blob_details: Union[_models.BlobDetails, JSON, IO[bytes]],
|
|
1960
|
+
**kwargs: Any
|
|
1961
|
+
) -> _models.SasUriResponse:
|
|
1962
|
+
"""Gets a URL with SAS token for a container/blob in the storage account associated with the
|
|
1963
|
+
workspace. The SAS URL can be used to upload job input and/or download job output.
|
|
1526
1964
|
|
|
1527
|
-
:param
|
|
1528
|
-
:type
|
|
1529
|
-
:param
|
|
1530
|
-
|
|
1531
|
-
:
|
|
1532
|
-
:
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
:
|
|
1536
|
-
:
|
|
1965
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
1966
|
+
:type subscription_id: str
|
|
1967
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
1968
|
+
:type resource_group_name: str
|
|
1969
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
1970
|
+
:type workspace_name: str
|
|
1971
|
+
:param blob_details: The details (name and container) of the blob. Is one of the following
|
|
1972
|
+
types: BlobDetails, JSON, IO[bytes] Required.
|
|
1973
|
+
:type blob_details: ~azure.quantum.models.BlobDetails or JSON or IO[bytes]
|
|
1974
|
+
:return: SasUriResponse. The SasUriResponse is compatible with MutableMapping
|
|
1975
|
+
:rtype: ~azure.quantum.models.SasUriResponse
|
|
1537
1976
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1538
1977
|
"""
|
|
1539
|
-
error_map = {
|
|
1978
|
+
error_map: MutableMapping = {
|
|
1540
1979
|
401: ClientAuthenticationError,
|
|
1541
1980
|
404: ResourceNotFoundError,
|
|
1542
1981
|
409: ResourceExistsError,
|
|
@@ -1548,136 +1987,99 @@ class SessionsOperations:
|
|
|
1548
1987
|
_params = kwargs.pop("params", {}) or {}
|
|
1549
1988
|
|
|
1550
1989
|
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
|
|
1551
|
-
cls: ClsType[_models.
|
|
1990
|
+
cls: ClsType[_models.SasUriResponse] = kwargs.pop("cls", None)
|
|
1552
1991
|
|
|
1553
1992
|
content_type = content_type or "application/json"
|
|
1554
|
-
_json = None
|
|
1555
1993
|
_content = None
|
|
1556
|
-
if isinstance(
|
|
1557
|
-
_content =
|
|
1994
|
+
if isinstance(blob_details, (IOBase, bytes)):
|
|
1995
|
+
_content = blob_details
|
|
1558
1996
|
else:
|
|
1559
|
-
|
|
1997
|
+
_content = json.dumps(blob_details, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore
|
|
1560
1998
|
|
|
1561
|
-
_request =
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
workspace_name=self._config.workspace_name,
|
|
1999
|
+
_request = build_storage_get_sas_uri_request(
|
|
2000
|
+
subscription_id=subscription_id,
|
|
2001
|
+
resource_group_name=resource_group_name,
|
|
2002
|
+
workspace_name=workspace_name,
|
|
1566
2003
|
content_type=content_type,
|
|
1567
2004
|
api_version=self._config.api_version,
|
|
1568
|
-
json=_json,
|
|
1569
2005
|
content=_content,
|
|
1570
2006
|
headers=_headers,
|
|
1571
2007
|
params=_params,
|
|
1572
2008
|
)
|
|
1573
2009
|
path_format_arguments = {
|
|
1574
|
-
"
|
|
1575
|
-
|
|
2010
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
2011
|
+
"serviceBaseUrl": self._serialize.url(
|
|
2012
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
1576
2013
|
),
|
|
1577
2014
|
}
|
|
1578
2015
|
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1579
2016
|
|
|
1580
|
-
_stream = False
|
|
2017
|
+
_stream = kwargs.pop("stream", False)
|
|
1581
2018
|
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
1582
2019
|
_request, stream=_stream, **kwargs
|
|
1583
2020
|
)
|
|
1584
2021
|
|
|
1585
2022
|
response = pipeline_response.http_response
|
|
1586
2023
|
|
|
1587
|
-
if response.status_code not in [200
|
|
2024
|
+
if response.status_code not in [200]:
|
|
1588
2025
|
if _stream:
|
|
1589
|
-
|
|
2026
|
+
try:
|
|
2027
|
+
response.read() # Load the body in memory and close the socket
|
|
2028
|
+
except (StreamConsumedError, StreamClosedError):
|
|
2029
|
+
pass
|
|
1590
2030
|
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1591
|
-
|
|
1592
|
-
raise HttpResponseError(response=response, model=error)
|
|
1593
|
-
|
|
1594
|
-
if response.status_code == 200:
|
|
1595
|
-
deserialized = self._deserialize("SessionDetails", pipeline_response)
|
|
2031
|
+
raise HttpResponseError(response=response)
|
|
1596
2032
|
|
|
1597
|
-
if
|
|
1598
|
-
deserialized =
|
|
2033
|
+
if _stream:
|
|
2034
|
+
deserialized = response.iter_bytes()
|
|
2035
|
+
else:
|
|
2036
|
+
deserialized = _deserialize(_models.SasUriResponse, response.json())
|
|
1599
2037
|
|
|
1600
2038
|
if cls:
|
|
1601
2039
|
return cls(pipeline_response, deserialized, {}) # type: ignore
|
|
1602
2040
|
|
|
1603
2041
|
return deserialized # type: ignore
|
|
1604
2042
|
|
|
1605
|
-
@distributed_trace
|
|
1606
|
-
def close(self, session_id: str, **kwargs: Any) -> _models.SessionDetails:
|
|
1607
|
-
"""Close a session.
|
|
1608
|
-
|
|
1609
|
-
:param session_id: Id of the session. Required.
|
|
1610
|
-
:type session_id: str
|
|
1611
|
-
:return: SessionDetails
|
|
1612
|
-
:rtype: ~azure.quantum._client.models.SessionDetails
|
|
1613
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1614
|
-
"""
|
|
1615
|
-
error_map = {
|
|
1616
|
-
401: ClientAuthenticationError,
|
|
1617
|
-
404: ResourceNotFoundError,
|
|
1618
|
-
409: ResourceExistsError,
|
|
1619
|
-
304: ResourceNotModifiedError,
|
|
1620
|
-
}
|
|
1621
|
-
error_map.update(kwargs.pop("error_map", {}) or {})
|
|
1622
|
-
|
|
1623
|
-
_headers = kwargs.pop("headers", {}) or {}
|
|
1624
|
-
_params = kwargs.pop("params", {}) or {}
|
|
1625
|
-
|
|
1626
|
-
cls: ClsType[_models.SessionDetails] = kwargs.pop("cls", None)
|
|
1627
2043
|
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
workspace_name=self._config.workspace_name,
|
|
1633
|
-
api_version=self._config.api_version,
|
|
1634
|
-
headers=_headers,
|
|
1635
|
-
params=_params,
|
|
1636
|
-
)
|
|
1637
|
-
path_format_arguments = {
|
|
1638
|
-
"azureRegion": self._serialize.url(
|
|
1639
|
-
"self._config.azure_region", self._config.azure_region, "str", skip_quote=True
|
|
1640
|
-
),
|
|
1641
|
-
}
|
|
1642
|
-
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
1643
|
-
|
|
1644
|
-
_stream = False
|
|
1645
|
-
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
|
|
1646
|
-
_request, stream=_stream, **kwargs
|
|
1647
|
-
)
|
|
1648
|
-
|
|
1649
|
-
response = pipeline_response.http_response
|
|
1650
|
-
|
|
1651
|
-
if response.status_code not in [200]:
|
|
1652
|
-
if _stream:
|
|
1653
|
-
response.read() # Load the body in memory and close the socket
|
|
1654
|
-
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1655
|
-
error = self._deserialize.failsafe_deserialize(_models.RestError, pipeline_response)
|
|
1656
|
-
raise HttpResponseError(response=response, model=error)
|
|
1657
|
-
|
|
1658
|
-
deserialized = self._deserialize("SessionDetails", pipeline_response)
|
|
2044
|
+
class QuotasOperations:
|
|
2045
|
+
"""
|
|
2046
|
+
.. warning::
|
|
2047
|
+
**DO NOT** instantiate this class directly.
|
|
1659
2048
|
|
|
1660
|
-
|
|
1661
|
-
|
|
2049
|
+
Instead, you should access the following operations through
|
|
2050
|
+
:class:`~azure.quantum.ServicesClient`'s
|
|
2051
|
+
:attr:`quotas` attribute.
|
|
2052
|
+
"""
|
|
1662
2053
|
|
|
1663
|
-
|
|
2054
|
+
def __init__(self, *args, **kwargs):
|
|
2055
|
+
input_args = list(args)
|
|
2056
|
+
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
|
|
2057
|
+
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
|
|
2058
|
+
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
|
|
2059
|
+
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
|
|
1664
2060
|
|
|
1665
2061
|
@distributed_trace
|
|
1666
|
-
def
|
|
1667
|
-
|
|
2062
|
+
def list(
|
|
2063
|
+
self, subscription_id: str, resource_group_name: str, workspace_name: str, **kwargs: Any
|
|
2064
|
+
) -> Iterable["_models.Quota"]:
|
|
2065
|
+
"""List quotas for the given workspace.
|
|
1668
2066
|
|
|
1669
|
-
:param
|
|
1670
|
-
:type
|
|
1671
|
-
:
|
|
1672
|
-
:
|
|
2067
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
2068
|
+
:type subscription_id: str
|
|
2069
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
2070
|
+
:type resource_group_name: str
|
|
2071
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
2072
|
+
:type workspace_name: str
|
|
2073
|
+
:return: An iterator like instance of Quota
|
|
2074
|
+
:rtype: ~azure.core.paging.ItemPaged[~azure.quantum.models.Quota]
|
|
1673
2075
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1674
2076
|
"""
|
|
1675
2077
|
_headers = kwargs.pop("headers", {}) or {}
|
|
1676
2078
|
_params = kwargs.pop("params", {}) or {}
|
|
1677
2079
|
|
|
1678
|
-
cls: ClsType[_models.
|
|
2080
|
+
cls: ClsType[List[_models.Quota]] = kwargs.pop("cls", None)
|
|
1679
2081
|
|
|
1680
|
-
error_map = {
|
|
2082
|
+
error_map: MutableMapping = {
|
|
1681
2083
|
401: ClientAuthenticationError,
|
|
1682
2084
|
404: ResourceNotFoundError,
|
|
1683
2085
|
409: ResourceExistsError,
|
|
@@ -1688,18 +2090,18 @@ class SessionsOperations:
|
|
|
1688
2090
|
def prepare_request(next_link=None):
|
|
1689
2091
|
if not next_link:
|
|
1690
2092
|
|
|
1691
|
-
_request =
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
workspace_name=self._config.workspace_name,
|
|
2093
|
+
_request = build_quotas_list_request(
|
|
2094
|
+
subscription_id=subscription_id,
|
|
2095
|
+
resource_group_name=resource_group_name,
|
|
2096
|
+
workspace_name=workspace_name,
|
|
1696
2097
|
api_version=self._config.api_version,
|
|
1697
2098
|
headers=_headers,
|
|
1698
2099
|
params=_params,
|
|
1699
2100
|
)
|
|
1700
2101
|
path_format_arguments = {
|
|
1701
|
-
"
|
|
1702
|
-
|
|
2102
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
2103
|
+
"serviceBaseUrl": self._serialize.url(
|
|
2104
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
1703
2105
|
),
|
|
1704
2106
|
}
|
|
1705
2107
|
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
@@ -1718,8 +2120,9 @@ class SessionsOperations:
|
|
|
1718
2120
|
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
|
1719
2121
|
)
|
|
1720
2122
|
path_format_arguments = {
|
|
1721
|
-
"
|
|
1722
|
-
|
|
2123
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
2124
|
+
"serviceBaseUrl": self._serialize.url(
|
|
2125
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
1723
2126
|
),
|
|
1724
2127
|
}
|
|
1725
2128
|
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
@@ -1727,13 +2130,11 @@ class SessionsOperations:
|
|
|
1727
2130
|
return _request
|
|
1728
2131
|
|
|
1729
2132
|
def extract_data(pipeline_response):
|
|
1730
|
-
deserialized =
|
|
1731
|
-
|
|
1732
|
-
)
|
|
1733
|
-
list_of_elem = deserialized.value
|
|
2133
|
+
deserialized = pipeline_response.http_response.json()
|
|
2134
|
+
list_of_elem = _deserialize(List[_models.Quota], deserialized["value"])
|
|
1734
2135
|
if cls:
|
|
1735
2136
|
list_of_elem = cls(list_of_elem) # type: ignore
|
|
1736
|
-
return deserialized.
|
|
2137
|
+
return deserialized.get("nextLink") or None, iter(list_of_elem)
|
|
1737
2138
|
|
|
1738
2139
|
def get_next(next_link=None):
|
|
1739
2140
|
_request = prepare_request(next_link)
|
|
@@ -1745,11 +2146,8 @@ class SessionsOperations:
|
|
|
1745
2146
|
response = pipeline_response.http_response
|
|
1746
2147
|
|
|
1747
2148
|
if response.status_code not in [200]:
|
|
1748
|
-
if _stream:
|
|
1749
|
-
response.read() # Load the body in memory and close the socket
|
|
1750
2149
|
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1751
|
-
|
|
1752
|
-
raise HttpResponseError(response=response, model=error)
|
|
2150
|
+
raise HttpResponseError(response=response)
|
|
1753
2151
|
|
|
1754
2152
|
return pipeline_response
|
|
1755
2153
|
|
|
@@ -1762,12 +2160,10 @@ class TopLevelItemsOperations:
|
|
|
1762
2160
|
**DO NOT** instantiate this class directly.
|
|
1763
2161
|
|
|
1764
2162
|
Instead, you should access the following operations through
|
|
1765
|
-
:class:`~azure.quantum.
|
|
2163
|
+
:class:`~azure.quantum.ServicesClient`'s
|
|
1766
2164
|
:attr:`top_level_items` attribute.
|
|
1767
2165
|
"""
|
|
1768
2166
|
|
|
1769
|
-
models = _models
|
|
1770
|
-
|
|
1771
2167
|
def __init__(self, *args, **kwargs):
|
|
1772
2168
|
input_args = list(args)
|
|
1773
2169
|
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
|
|
@@ -1776,19 +2172,44 @@ class TopLevelItemsOperations:
|
|
|
1776
2172
|
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
|
|
1777
2173
|
|
|
1778
2174
|
@distributed_trace
|
|
1779
|
-
def list(
|
|
2175
|
+
def list(
|
|
2176
|
+
self,
|
|
2177
|
+
subscription_id: str,
|
|
2178
|
+
resource_group_name: str,
|
|
2179
|
+
workspace_name: str,
|
|
2180
|
+
*,
|
|
2181
|
+
filter: Optional[str] = None,
|
|
2182
|
+
skip: Optional[int] = None,
|
|
2183
|
+
top: Optional[int] = None,
|
|
2184
|
+
orderby: Optional[str] = None,
|
|
2185
|
+
**kwargs: Any
|
|
2186
|
+
) -> Iterable["_models.ItemDetails"]:
|
|
1780
2187
|
"""List top-level items.
|
|
1781
2188
|
|
|
2189
|
+
:param subscription_id: The Azure subscription ID. Required.
|
|
2190
|
+
:type subscription_id: str
|
|
2191
|
+
:param resource_group_name: Name of the Azure resource group. Required.
|
|
2192
|
+
:type resource_group_name: str
|
|
2193
|
+
:param workspace_name: Name of the Azure Quantum workspace. Required.
|
|
2194
|
+
:type workspace_name: str
|
|
2195
|
+
:keyword filter: Filter the result list using the given expression. Default value is None.
|
|
2196
|
+
:paramtype filter: str
|
|
2197
|
+
:keyword skip: The number of result items to skip. Default value is None.
|
|
2198
|
+
:paramtype skip: int
|
|
2199
|
+
:keyword top: The number of jobs taken. Default value is None.
|
|
2200
|
+
:paramtype top: int
|
|
2201
|
+
:keyword orderby: The order of returned items. Default value is None.
|
|
2202
|
+
:paramtype orderby: str
|
|
1782
2203
|
:return: An iterator like instance of ItemDetails
|
|
1783
|
-
:rtype: ~azure.core.paging.ItemPaged[~azure.quantum.
|
|
2204
|
+
:rtype: ~azure.core.paging.ItemPaged[~azure.quantum.models.ItemDetails]
|
|
1784
2205
|
:raises ~azure.core.exceptions.HttpResponseError:
|
|
1785
2206
|
"""
|
|
1786
2207
|
_headers = kwargs.pop("headers", {}) or {}
|
|
1787
2208
|
_params = kwargs.pop("params", {}) or {}
|
|
1788
2209
|
|
|
1789
|
-
cls: ClsType[_models.
|
|
2210
|
+
cls: ClsType[List[_models.ItemDetails]] = kwargs.pop("cls", None)
|
|
1790
2211
|
|
|
1791
|
-
error_map = {
|
|
2212
|
+
error_map: MutableMapping = {
|
|
1792
2213
|
401: ClientAuthenticationError,
|
|
1793
2214
|
404: ResourceNotFoundError,
|
|
1794
2215
|
409: ResourceExistsError,
|
|
@@ -1800,16 +2221,21 @@ class TopLevelItemsOperations:
|
|
|
1800
2221
|
if not next_link:
|
|
1801
2222
|
|
|
1802
2223
|
_request = build_top_level_items_list_request(
|
|
1803
|
-
subscription_id=
|
|
1804
|
-
resource_group_name=
|
|
1805
|
-
workspace_name=
|
|
2224
|
+
subscription_id=subscription_id,
|
|
2225
|
+
resource_group_name=resource_group_name,
|
|
2226
|
+
workspace_name=workspace_name,
|
|
2227
|
+
filter=filter,
|
|
2228
|
+
skip=skip,
|
|
2229
|
+
top=top,
|
|
2230
|
+
orderby=orderby,
|
|
1806
2231
|
api_version=self._config.api_version,
|
|
1807
2232
|
headers=_headers,
|
|
1808
2233
|
params=_params,
|
|
1809
2234
|
)
|
|
1810
2235
|
path_format_arguments = {
|
|
1811
|
-
"
|
|
1812
|
-
|
|
2236
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
2237
|
+
"serviceBaseUrl": self._serialize.url(
|
|
2238
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
1813
2239
|
),
|
|
1814
2240
|
}
|
|
1815
2241
|
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
@@ -1828,8 +2254,9 @@ class TopLevelItemsOperations:
|
|
|
1828
2254
|
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
|
|
1829
2255
|
)
|
|
1830
2256
|
path_format_arguments = {
|
|
1831
|
-
"
|
|
1832
|
-
|
|
2257
|
+
"region": self._serialize.url("self._config.region", self._config.region, "str"),
|
|
2258
|
+
"serviceBaseUrl": self._serialize.url(
|
|
2259
|
+
"self._config.service_base_url", self._config.service_base_url, "str"
|
|
1833
2260
|
),
|
|
1834
2261
|
}
|
|
1835
2262
|
_request.url = self._client.format_url(_request.url, **path_format_arguments)
|
|
@@ -1837,13 +2264,11 @@ class TopLevelItemsOperations:
|
|
|
1837
2264
|
return _request
|
|
1838
2265
|
|
|
1839
2266
|
def extract_data(pipeline_response):
|
|
1840
|
-
deserialized =
|
|
1841
|
-
|
|
1842
|
-
)
|
|
1843
|
-
list_of_elem = deserialized.value
|
|
2267
|
+
deserialized = pipeline_response.http_response.json()
|
|
2268
|
+
list_of_elem = _deserialize(List[_models.ItemDetails], deserialized["value"])
|
|
1844
2269
|
if cls:
|
|
1845
2270
|
list_of_elem = cls(list_of_elem) # type: ignore
|
|
1846
|
-
return deserialized.
|
|
2271
|
+
return deserialized.get("nextLink") or None, iter(list_of_elem)
|
|
1847
2272
|
|
|
1848
2273
|
def get_next(next_link=None):
|
|
1849
2274
|
_request = prepare_request(next_link)
|
|
@@ -1855,11 +2280,8 @@ class TopLevelItemsOperations:
|
|
|
1855
2280
|
response = pipeline_response.http_response
|
|
1856
2281
|
|
|
1857
2282
|
if response.status_code not in [200]:
|
|
1858
|
-
if _stream:
|
|
1859
|
-
response.read() # Load the body in memory and close the socket
|
|
1860
2283
|
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
1861
|
-
|
|
1862
|
-
raise HttpResponseError(response=response, model=error)
|
|
2284
|
+
raise HttpResponseError(response=response)
|
|
1863
2285
|
|
|
1864
2286
|
return pipeline_response
|
|
1865
2287
|
|