diracx-client 0.0.1a12__py3-none-any.whl → 0.0.1a14__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,12 +1,23 @@
1
1
  # pylint: disable=too-many-lines,too-many-statements
2
2
  # coding=utf-8
3
3
  # --------------------------------------------------------------------------
4
- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/python@6.13.2)
4
+ # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/python@6.13.9)
5
5
  # Changes may cause incorrect behavior and will be lost if the code is regenerated.
6
6
  # --------------------------------------------------------------------------
7
7
  from io import IOBase
8
8
  import sys
9
- from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload
9
+ from typing import (
10
+ Any,
11
+ Callable,
12
+ Dict,
13
+ IO,
14
+ List,
15
+ Optional,
16
+ Type,
17
+ TypeVar,
18
+ Union,
19
+ overload,
20
+ )
10
21
 
11
22
  from azure.core import MatchConditions
12
23
  from azure.core.exceptions import (
@@ -344,6 +355,120 @@ def build_jobs_initiate_sandbox_upload_request(
344
355
  return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
345
356
 
346
357
 
358
+ def build_jobs_unassign_bulk_jobs_sandboxes_request( # pylint: disable=name-too-long
359
+ *, jobs_ids: List[int], **kwargs: Any
360
+ ) -> HttpRequest:
361
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
362
+ _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
363
+
364
+ accept = _headers.pop("Accept", "application/json")
365
+
366
+ # Construct URL
367
+ _url = "/api/jobs/sandbox"
368
+
369
+ # Construct parameters
370
+ _params["jobs_ids"] = _SERIALIZER.query("jobs_ids", jobs_ids, "[int]")
371
+
372
+ # Construct headers
373
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
374
+
375
+ return HttpRequest(
376
+ method="DELETE", url=_url, params=_params, headers=_headers, **kwargs
377
+ )
378
+
379
+
380
+ def build_jobs_get_job_sandboxes_request(job_id: int, **kwargs: Any) -> HttpRequest:
381
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
382
+
383
+ accept = _headers.pop("Accept", "application/json")
384
+
385
+ # Construct URL
386
+ _url = "/api/jobs/{job_id}/sandbox"
387
+ path_format_arguments = {
388
+ "job_id": _SERIALIZER.url("job_id", job_id, "int"),
389
+ }
390
+
391
+ _url: str = _url.format(**path_format_arguments) # type: ignore
392
+
393
+ # Construct headers
394
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
395
+
396
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
397
+
398
+
399
+ def build_jobs_unassign_job_sandboxes_request( # pylint: disable=name-too-long
400
+ job_id: int, **kwargs: Any
401
+ ) -> HttpRequest:
402
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
403
+
404
+ accept = _headers.pop("Accept", "application/json")
405
+
406
+ # Construct URL
407
+ _url = "/api/jobs/{job_id}/sandbox"
408
+ path_format_arguments = {
409
+ "job_id": _SERIALIZER.url("job_id", job_id, "int"),
410
+ }
411
+
412
+ _url: str = _url.format(**path_format_arguments) # type: ignore
413
+
414
+ # Construct headers
415
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
416
+
417
+ return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs)
418
+
419
+
420
+ def build_jobs_get_job_sandbox_request(
421
+ job_id: int, sandbox_type: Union[str, _models.SandboxType], **kwargs: Any
422
+ ) -> HttpRequest:
423
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
424
+
425
+ accept = _headers.pop("Accept", "application/json")
426
+
427
+ # Construct URL
428
+ _url = "/api/jobs/{job_id}/sandbox/{sandbox_type}"
429
+ path_format_arguments = {
430
+ "job_id": _SERIALIZER.url("job_id", job_id, "int"),
431
+ "sandbox_type": _SERIALIZER.url("sandbox_type", sandbox_type, "str"),
432
+ }
433
+
434
+ _url: str = _url.format(**path_format_arguments) # type: ignore
435
+
436
+ # Construct headers
437
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
438
+
439
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
440
+
441
+
442
+ def build_jobs_assign_sandbox_to_job_request(
443
+ job_id: int, *, content: str, **kwargs: Any
444
+ ) -> HttpRequest:
445
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
446
+
447
+ content_type: Optional[str] = kwargs.pop(
448
+ "content_type", _headers.pop("Content-Type", None)
449
+ )
450
+ accept = _headers.pop("Accept", "application/json")
451
+
452
+ # Construct URL
453
+ _url = "/api/jobs/{job_id}/sandbox/output"
454
+ path_format_arguments = {
455
+ "job_id": _SERIALIZER.url("job_id", job_id, "int"),
456
+ }
457
+
458
+ _url: str = _url.format(**path_format_arguments) # type: ignore
459
+
460
+ # Construct headers
461
+ if content_type is not None:
462
+ _headers["Content-Type"] = _SERIALIZER.header(
463
+ "content_type", content_type, "str"
464
+ )
465
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
466
+
467
+ return HttpRequest(
468
+ method="PATCH", url=_url, headers=_headers, content=content, **kwargs
469
+ )
470
+
471
+
347
472
  def build_jobs_submit_bulk_jobs_request(**kwargs: Any) -> HttpRequest:
348
473
  _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
349
474
 
@@ -812,13 +937,13 @@ class WellKnownOperations:
812
937
  def openid_configuration(self, **kwargs: Any) -> Any:
813
938
  """Openid Configuration.
814
939
 
815
- Openid Configuration.
940
+ OpenID Connect discovery endpoint.
816
941
 
817
942
  :return: any
818
943
  :rtype: any
819
944
  :raises ~azure.core.exceptions.HttpResponseError:
820
945
  """
821
- error_map = {
946
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
822
947
  401: ClientAuthenticationError,
823
948
  404: ResourceNotFoundError,
824
949
  409: ResourceExistsError,
@@ -865,13 +990,13 @@ class WellKnownOperations:
865
990
  def installation_metadata(self, **kwargs: Any) -> _models.Metadata:
866
991
  """Installation Metadata.
867
992
 
868
- Installation Metadata.
993
+ Get metadata about the dirac installation.
869
994
 
870
995
  :return: Metadata
871
996
  :rtype: ~client.models.Metadata
872
997
  :raises ~azure.core.exceptions.HttpResponseError:
873
998
  """
874
- error_map = {
999
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
875
1000
  401: ClientAuthenticationError,
876
1001
  404: ResourceNotFoundError,
877
1002
  409: ResourceExistsError,
@@ -962,7 +1087,7 @@ class AuthOperations: # pylint: disable=abstract-class-instantiated
962
1087
  :rtype: any
963
1088
  :raises ~azure.core.exceptions.HttpResponseError:
964
1089
  """
965
- error_map = {
1090
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
966
1091
  401: ClientAuthenticationError,
967
1092
  404: ResourceNotFoundError,
968
1093
  409: ResourceExistsError,
@@ -1028,7 +1153,7 @@ class AuthOperations: # pylint: disable=abstract-class-instantiated
1028
1153
  :rtype: ~client.models.InitiateDeviceFlowResponse
1029
1154
  :raises ~azure.core.exceptions.HttpResponseError:
1030
1155
  """
1031
- error_map = {
1156
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1032
1157
  401: ClientAuthenticationError,
1033
1158
  404: ResourceNotFoundError,
1034
1159
  409: ResourceExistsError,
@@ -1093,7 +1218,7 @@ class AuthOperations: # pylint: disable=abstract-class-instantiated
1093
1218
  :rtype: any
1094
1219
  :raises ~azure.core.exceptions.HttpResponseError:
1095
1220
  """
1096
- error_map = {
1221
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1097
1222
  401: ClientAuthenticationError,
1098
1223
  404: ResourceNotFoundError,
1099
1224
  409: ResourceExistsError,
@@ -1142,13 +1267,13 @@ class AuthOperations: # pylint: disable=abstract-class-instantiated
1142
1267
  def finished(self, **kwargs: Any) -> Any:
1143
1268
  """Finished.
1144
1269
 
1145
- Finished.
1270
+ This is the final step of the device flow.
1146
1271
 
1147
1272
  :return: any
1148
1273
  :rtype: any
1149
1274
  :raises ~azure.core.exceptions.HttpResponseError:
1150
1275
  """
1151
- error_map = {
1276
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1152
1277
  401: ClientAuthenticationError,
1153
1278
  404: ResourceNotFoundError,
1154
1279
  409: ResourceExistsError,
@@ -1202,7 +1327,7 @@ class AuthOperations: # pylint: disable=abstract-class-instantiated
1202
1327
  :rtype: list[any]
1203
1328
  :raises ~azure.core.exceptions.HttpResponseError:
1204
1329
  """
1205
- error_map = {
1330
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1206
1331
  401: ClientAuthenticationError,
1207
1332
  404: ResourceNotFoundError,
1208
1333
  409: ResourceExistsError,
@@ -1258,7 +1383,7 @@ class AuthOperations: # pylint: disable=abstract-class-instantiated
1258
1383
  :rtype: str
1259
1384
  :raises ~azure.core.exceptions.HttpResponseError:
1260
1385
  """
1261
- error_map = {
1386
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1262
1387
  401: ClientAuthenticationError,
1263
1388
  404: ResourceNotFoundError,
1264
1389
  409: ResourceExistsError,
@@ -1312,7 +1437,7 @@ class AuthOperations: # pylint: disable=abstract-class-instantiated
1312
1437
  :rtype: ~client.models.UserInfoResponse
1313
1438
  :raises ~azure.core.exceptions.HttpResponseError:
1314
1439
  """
1315
- error_map = {
1440
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1316
1441
  401: ClientAuthenticationError,
1317
1442
  404: ResourceNotFoundError,
1318
1443
  409: ResourceExistsError,
@@ -1370,7 +1495,13 @@ class AuthOperations: # pylint: disable=abstract-class-instantiated
1370
1495
  ) -> Any:
1371
1496
  """Authorization Flow.
1372
1497
 
1373
- Authorization Flow.
1498
+ Initiate the authorization flow.
1499
+ It will redirect to the actual OpenID server (IAM, CheckIn) to
1500
+ perform a authorization code flow.
1501
+
1502
+ We set the user details obtained from the user authorize flow in a cookie
1503
+ to be able to map the authorization flow with the corresponding
1504
+ user authorize flow.
1374
1505
 
1375
1506
  :keyword response_type: "code" Required.
1376
1507
  :paramtype response_type: str or ~client.models.Enum0
@@ -1390,7 +1521,7 @@ class AuthOperations: # pylint: disable=abstract-class-instantiated
1390
1521
  :rtype: any
1391
1522
  :raises ~azure.core.exceptions.HttpResponseError:
1392
1523
  """
1393
- error_map = {
1524
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1394
1525
  401: ClientAuthenticationError,
1395
1526
  404: ResourceNotFoundError,
1396
1527
  409: ResourceExistsError,
@@ -1446,7 +1577,13 @@ class AuthOperations: # pylint: disable=abstract-class-instantiated
1446
1577
  ) -> Any:
1447
1578
  """Authorization Flow Complete.
1448
1579
 
1449
- Authorization Flow Complete.
1580
+ Complete the authorization flow.
1581
+
1582
+ The user is redirected back to the DIRAC auth service after completing the IAM's authorization
1583
+ flow.
1584
+ We retrieve the original flow details from the decrypted state and store the ID token requested
1585
+ from the IAM.
1586
+ The user is then redirected to the client's redirect URI.
1450
1587
 
1451
1588
  :keyword code: Required.
1452
1589
  :paramtype code: str
@@ -1456,7 +1593,7 @@ class AuthOperations: # pylint: disable=abstract-class-instantiated
1456
1593
  :rtype: any
1457
1594
  :raises ~azure.core.exceptions.HttpResponseError:
1458
1595
  """
1459
- error_map = {
1596
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1460
1597
  401: ClientAuthenticationError,
1461
1598
  404: ResourceNotFoundError,
1462
1599
  409: ResourceExistsError,
@@ -1552,7 +1689,7 @@ class ConfigOperations:
1552
1689
  :rtype: any
1553
1690
  :raises ~azure.core.exceptions.HttpResponseError:
1554
1691
  """
1555
- error_map = {
1692
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1556
1693
  401: ClientAuthenticationError,
1557
1694
  404: ResourceNotFoundError,
1558
1695
  409: ResourceExistsError,
@@ -1646,7 +1783,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1646
1783
  :rtype: ~client.models.SandboxDownloadResponse
1647
1784
  :raises ~azure.core.exceptions.HttpResponseError:
1648
1785
  """
1649
- error_map = {
1786
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1650
1787
  401: ClientAuthenticationError,
1651
1788
  404: ResourceNotFoundError,
1652
1789
  409: ResourceExistsError,
@@ -1762,7 +1899,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1762
1899
  :rtype: ~client.models.SandboxUploadResponse
1763
1900
  :raises ~azure.core.exceptions.HttpResponseError:
1764
1901
  """
1765
- error_map = {
1902
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1766
1903
  401: ClientAuthenticationError,
1767
1904
  404: ResourceNotFoundError,
1768
1905
  409: ResourceExistsError,
@@ -1819,6 +1956,302 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1819
1956
 
1820
1957
  return deserialized # type: ignore
1821
1958
 
1959
+ @distributed_trace
1960
+ def unassign_bulk_jobs_sandboxes(
1961
+ self, *, jobs_ids: List[int], **kwargs: Any
1962
+ ) -> Any:
1963
+ """Unassign Bulk Jobs Sandboxes.
1964
+
1965
+ Delete bulk jobs sandbox mapping.
1966
+
1967
+ :keyword jobs_ids: Required.
1968
+ :paramtype jobs_ids: list[int]
1969
+ :return: any
1970
+ :rtype: any
1971
+ :raises ~azure.core.exceptions.HttpResponseError:
1972
+ """
1973
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1974
+ 401: ClientAuthenticationError,
1975
+ 404: ResourceNotFoundError,
1976
+ 409: ResourceExistsError,
1977
+ 304: ResourceNotModifiedError,
1978
+ }
1979
+ error_map.update(kwargs.pop("error_map", {}) or {})
1980
+
1981
+ _headers = kwargs.pop("headers", {}) or {}
1982
+ _params = kwargs.pop("params", {}) or {}
1983
+
1984
+ cls: ClsType[Any] = kwargs.pop("cls", None)
1985
+
1986
+ _request = build_jobs_unassign_bulk_jobs_sandboxes_request(
1987
+ jobs_ids=jobs_ids,
1988
+ headers=_headers,
1989
+ params=_params,
1990
+ )
1991
+ _request.url = self._client.format_url(_request.url)
1992
+
1993
+ _stream = False
1994
+ pipeline_response: PipelineResponse = (
1995
+ self._client._pipeline.run( # pylint: disable=protected-access
1996
+ _request, stream=_stream, **kwargs
1997
+ )
1998
+ )
1999
+
2000
+ response = pipeline_response.http_response
2001
+
2002
+ if response.status_code not in [200]:
2003
+ if _stream:
2004
+ response.read() # Load the body in memory and close the socket
2005
+ map_error(
2006
+ status_code=response.status_code, response=response, error_map=error_map
2007
+ )
2008
+ raise HttpResponseError(response=response)
2009
+
2010
+ deserialized = self._deserialize("object", pipeline_response)
2011
+
2012
+ if cls:
2013
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2014
+
2015
+ return deserialized # type: ignore
2016
+
2017
+ @distributed_trace
2018
+ def get_job_sandboxes(self, job_id: int, **kwargs: Any) -> Dict[str, List[Any]]:
2019
+ """Get Job Sandboxes.
2020
+
2021
+ Get input and output sandboxes of given job.
2022
+
2023
+ :param job_id: Required.
2024
+ :type job_id: int
2025
+ :return: dict mapping str to list of any
2026
+ :rtype: dict[str, list[any]]
2027
+ :raises ~azure.core.exceptions.HttpResponseError:
2028
+ """
2029
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2030
+ 401: ClientAuthenticationError,
2031
+ 404: ResourceNotFoundError,
2032
+ 409: ResourceExistsError,
2033
+ 304: ResourceNotModifiedError,
2034
+ }
2035
+ error_map.update(kwargs.pop("error_map", {}) or {})
2036
+
2037
+ _headers = kwargs.pop("headers", {}) or {}
2038
+ _params = kwargs.pop("params", {}) or {}
2039
+
2040
+ cls: ClsType[Dict[str, List[Any]]] = kwargs.pop("cls", None)
2041
+
2042
+ _request = build_jobs_get_job_sandboxes_request(
2043
+ job_id=job_id,
2044
+ headers=_headers,
2045
+ params=_params,
2046
+ )
2047
+ _request.url = self._client.format_url(_request.url)
2048
+
2049
+ _stream = False
2050
+ pipeline_response: PipelineResponse = (
2051
+ self._client._pipeline.run( # pylint: disable=protected-access
2052
+ _request, stream=_stream, **kwargs
2053
+ )
2054
+ )
2055
+
2056
+ response = pipeline_response.http_response
2057
+
2058
+ if response.status_code not in [200]:
2059
+ if _stream:
2060
+ response.read() # Load the body in memory and close the socket
2061
+ map_error(
2062
+ status_code=response.status_code, response=response, error_map=error_map
2063
+ )
2064
+ raise HttpResponseError(response=response)
2065
+
2066
+ deserialized = self._deserialize("{[object]}", pipeline_response)
2067
+
2068
+ if cls:
2069
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2070
+
2071
+ return deserialized # type: ignore
2072
+
2073
+ @distributed_trace
2074
+ def unassign_job_sandboxes(self, job_id: int, **kwargs: Any) -> Any:
2075
+ """Unassign Job Sandboxes.
2076
+
2077
+ Delete single job sandbox mapping.
2078
+
2079
+ :param job_id: Required.
2080
+ :type job_id: int
2081
+ :return: any
2082
+ :rtype: any
2083
+ :raises ~azure.core.exceptions.HttpResponseError:
2084
+ """
2085
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2086
+ 401: ClientAuthenticationError,
2087
+ 404: ResourceNotFoundError,
2088
+ 409: ResourceExistsError,
2089
+ 304: ResourceNotModifiedError,
2090
+ }
2091
+ error_map.update(kwargs.pop("error_map", {}) or {})
2092
+
2093
+ _headers = kwargs.pop("headers", {}) or {}
2094
+ _params = kwargs.pop("params", {}) or {}
2095
+
2096
+ cls: ClsType[Any] = kwargs.pop("cls", None)
2097
+
2098
+ _request = build_jobs_unassign_job_sandboxes_request(
2099
+ job_id=job_id,
2100
+ headers=_headers,
2101
+ params=_params,
2102
+ )
2103
+ _request.url = self._client.format_url(_request.url)
2104
+
2105
+ _stream = False
2106
+ pipeline_response: PipelineResponse = (
2107
+ self._client._pipeline.run( # pylint: disable=protected-access
2108
+ _request, stream=_stream, **kwargs
2109
+ )
2110
+ )
2111
+
2112
+ response = pipeline_response.http_response
2113
+
2114
+ if response.status_code not in [200]:
2115
+ if _stream:
2116
+ response.read() # Load the body in memory and close the socket
2117
+ map_error(
2118
+ status_code=response.status_code, response=response, error_map=error_map
2119
+ )
2120
+ raise HttpResponseError(response=response)
2121
+
2122
+ deserialized = self._deserialize("object", pipeline_response)
2123
+
2124
+ if cls:
2125
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2126
+
2127
+ return deserialized # type: ignore
2128
+
2129
+ @distributed_trace
2130
+ def get_job_sandbox(
2131
+ self, job_id: int, sandbox_type: Union[str, _models.SandboxType], **kwargs: Any
2132
+ ) -> List[Any]:
2133
+ """Get Job Sandbox.
2134
+
2135
+ Get input or output sandbox of given job.
2136
+
2137
+ :param job_id: Required.
2138
+ :type job_id: int
2139
+ :param sandbox_type: Known values are: "input" and "output". Required.
2140
+ :type sandbox_type: str or ~client.models.SandboxType
2141
+ :return: list of any
2142
+ :rtype: list[any]
2143
+ :raises ~azure.core.exceptions.HttpResponseError:
2144
+ """
2145
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2146
+ 401: ClientAuthenticationError,
2147
+ 404: ResourceNotFoundError,
2148
+ 409: ResourceExistsError,
2149
+ 304: ResourceNotModifiedError,
2150
+ }
2151
+ error_map.update(kwargs.pop("error_map", {}) or {})
2152
+
2153
+ _headers = kwargs.pop("headers", {}) or {}
2154
+ _params = kwargs.pop("params", {}) or {}
2155
+
2156
+ cls: ClsType[List[Any]] = kwargs.pop("cls", None)
2157
+
2158
+ _request = build_jobs_get_job_sandbox_request(
2159
+ job_id=job_id,
2160
+ sandbox_type=sandbox_type,
2161
+ headers=_headers,
2162
+ params=_params,
2163
+ )
2164
+ _request.url = self._client.format_url(_request.url)
2165
+
2166
+ _stream = False
2167
+ pipeline_response: PipelineResponse = (
2168
+ self._client._pipeline.run( # pylint: disable=protected-access
2169
+ _request, stream=_stream, **kwargs
2170
+ )
2171
+ )
2172
+
2173
+ response = pipeline_response.http_response
2174
+
2175
+ if response.status_code not in [200]:
2176
+ if _stream:
2177
+ response.read() # Load the body in memory and close the socket
2178
+ map_error(
2179
+ status_code=response.status_code, response=response, error_map=error_map
2180
+ )
2181
+ raise HttpResponseError(response=response)
2182
+
2183
+ deserialized = self._deserialize("[object]", pipeline_response)
2184
+
2185
+ if cls:
2186
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2187
+
2188
+ return deserialized # type: ignore
2189
+
2190
+ @distributed_trace
2191
+ def assign_sandbox_to_job(self, job_id: int, body: str, **kwargs: Any) -> Any:
2192
+ """Assign Sandbox To Job.
2193
+
2194
+ Mapp the pfn as output sandbox to job.
2195
+
2196
+ :param job_id: Required.
2197
+ :type job_id: int
2198
+ :param body: Required.
2199
+ :type body: str
2200
+ :return: any
2201
+ :rtype: any
2202
+ :raises ~azure.core.exceptions.HttpResponseError:
2203
+ """
2204
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2205
+ 401: ClientAuthenticationError,
2206
+ 404: ResourceNotFoundError,
2207
+ 409: ResourceExistsError,
2208
+ 304: ResourceNotModifiedError,
2209
+ }
2210
+ error_map.update(kwargs.pop("error_map", {}) or {})
2211
+
2212
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
2213
+ _params = kwargs.pop("params", {}) or {}
2214
+
2215
+ content_type: str = kwargs.pop(
2216
+ "content_type", _headers.pop("Content-Type", "application/json")
2217
+ )
2218
+ cls: ClsType[Any] = kwargs.pop("cls", None)
2219
+
2220
+ _content = self._serialize.body(body, "str")
2221
+
2222
+ _request = build_jobs_assign_sandbox_to_job_request(
2223
+ job_id=job_id,
2224
+ content_type=content_type,
2225
+ content=_content,
2226
+ headers=_headers,
2227
+ params=_params,
2228
+ )
2229
+ _request.url = self._client.format_url(_request.url)
2230
+
2231
+ _stream = False
2232
+ pipeline_response: PipelineResponse = (
2233
+ self._client._pipeline.run( # pylint: disable=protected-access
2234
+ _request, stream=_stream, **kwargs
2235
+ )
2236
+ )
2237
+
2238
+ response = pipeline_response.http_response
2239
+
2240
+ if response.status_code not in [200]:
2241
+ if _stream:
2242
+ response.read() # Load the body in memory and close the socket
2243
+ map_error(
2244
+ status_code=response.status_code, response=response, error_map=error_map
2245
+ )
2246
+ raise HttpResponseError(response=response)
2247
+
2248
+ deserialized = self._deserialize("object", pipeline_response)
2249
+
2250
+ if cls:
2251
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2252
+
2253
+ return deserialized # type: ignore
2254
+
1822
2255
  @overload
1823
2256
  def submit_bulk_jobs(
1824
2257
  self, body: List[str], *, content_type: str = "application/json", **kwargs: Any
@@ -1869,7 +2302,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1869
2302
  :rtype: list[~client.models.InsertedJob]
1870
2303
  :raises ~azure.core.exceptions.HttpResponseError:
1871
2304
  """
1872
- error_map = {
2305
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1873
2306
  401: ClientAuthenticationError,
1874
2307
  404: ResourceNotFoundError,
1875
2308
  409: ResourceExistsError,
@@ -1938,7 +2371,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1938
2371
  :rtype: any
1939
2372
  :raises ~azure.core.exceptions.HttpResponseError:
1940
2373
  """
1941
- error_map = {
2374
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1942
2375
  401: ClientAuthenticationError,
1943
2376
  404: ResourceNotFoundError,
1944
2377
  409: ResourceExistsError,
@@ -1994,7 +2427,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1994
2427
  :rtype: any
1995
2428
  :raises ~azure.core.exceptions.HttpResponseError:
1996
2429
  """
1997
- error_map = {
2430
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1998
2431
  401: ClientAuthenticationError,
1999
2432
  404: ResourceNotFoundError,
2000
2433
  409: ResourceExistsError,
@@ -2054,7 +2487,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2054
2487
  :rtype: any
2055
2488
  :raises ~azure.core.exceptions.HttpResponseError:
2056
2489
  """
2057
- error_map = {
2490
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2058
2491
  401: ClientAuthenticationError,
2059
2492
  404: ResourceNotFoundError,
2060
2493
  409: ResourceExistsError,
@@ -2112,7 +2545,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2112
2545
  :rtype: dict[str, ~client.models.LimitedJobStatusReturn]
2113
2546
  :raises ~azure.core.exceptions.HttpResponseError:
2114
2547
  """
2115
- error_map = {
2548
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2116
2549
  401: ClientAuthenticationError,
2117
2550
  404: ResourceNotFoundError,
2118
2551
  409: ResourceExistsError,
@@ -2228,7 +2661,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2228
2661
  :rtype: dict[str, ~client.models.SetJobStatusReturn]
2229
2662
  :raises ~azure.core.exceptions.HttpResponseError:
2230
2663
  """
2231
- error_map = {
2664
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2232
2665
  401: ClientAuthenticationError,
2233
2666
  404: ResourceNotFoundError,
2234
2667
  409: ResourceExistsError,
@@ -2300,7 +2733,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2300
2733
  :rtype: dict[str, list[~client.models.JobStatusReturn]]
2301
2734
  :raises ~azure.core.exceptions.HttpResponseError:
2302
2735
  """
2303
- error_map = {
2736
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2304
2737
  401: ClientAuthenticationError,
2305
2738
  404: ResourceNotFoundError,
2306
2739
  409: ResourceExistsError,
@@ -2356,7 +2789,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2356
2789
  :rtype: any
2357
2790
  :raises ~azure.core.exceptions.HttpResponseError:
2358
2791
  """
2359
- error_map = {
2792
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2360
2793
  401: ClientAuthenticationError,
2361
2794
  404: ResourceNotFoundError,
2362
2795
  409: ResourceExistsError,
@@ -2412,7 +2845,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2412
2845
  :rtype: any
2413
2846
  :raises ~azure.core.exceptions.HttpResponseError:
2414
2847
  """
2415
- error_map = {
2848
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2416
2849
  401: ClientAuthenticationError,
2417
2850
  404: ResourceNotFoundError,
2418
2851
  409: ResourceExistsError,
@@ -2541,7 +2974,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2541
2974
  :rtype: list[JSON]
2542
2975
  :raises ~azure.core.exceptions.HttpResponseError:
2543
2976
  """
2544
- error_map = {
2977
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2545
2978
  401: ClientAuthenticationError,
2546
2979
  404: ResourceNotFoundError,
2547
2980
  409: ResourceExistsError,
@@ -2657,7 +3090,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2657
3090
  :rtype: any
2658
3091
  :raises ~azure.core.exceptions.HttpResponseError:
2659
3092
  """
2660
- error_map = {
3093
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2661
3094
  401: ClientAuthenticationError,
2662
3095
  404: ResourceNotFoundError,
2663
3096
  409: ResourceExistsError,
@@ -2726,7 +3159,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2726
3159
  :rtype: any
2727
3160
  :raises ~azure.core.exceptions.HttpResponseError:
2728
3161
  """
2729
- error_map = {
3162
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2730
3163
  401: ClientAuthenticationError,
2731
3164
  404: ResourceNotFoundError,
2732
3165
  409: ResourceExistsError,
@@ -2782,7 +3215,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2782
3215
  :rtype: any
2783
3216
  :raises ~azure.core.exceptions.HttpResponseError:
2784
3217
  """
2785
- error_map = {
3218
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2786
3219
  401: ClientAuthenticationError,
2787
3220
  404: ResourceNotFoundError,
2788
3221
  409: ResourceExistsError,
@@ -2844,7 +3277,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2844
3277
  :rtype: any
2845
3278
  :raises ~azure.core.exceptions.HttpResponseError:
2846
3279
  """
2847
- error_map = {
3280
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2848
3281
  401: ClientAuthenticationError,
2849
3282
  404: ResourceNotFoundError,
2850
3283
  409: ResourceExistsError,
@@ -2908,7 +3341,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2908
3341
  :rtype: any
2909
3342
  :raises ~azure.core.exceptions.HttpResponseError:
2910
3343
  """
2911
- error_map = {
3344
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2912
3345
  401: ClientAuthenticationError,
2913
3346
  404: ResourceNotFoundError,
2914
3347
  409: ResourceExistsError,
@@ -2968,7 +3401,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2968
3401
  :rtype: any
2969
3402
  :raises ~azure.core.exceptions.HttpResponseError:
2970
3403
  """
2971
- error_map = {
3404
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2972
3405
  401: ClientAuthenticationError,
2973
3406
  404: ResourceNotFoundError,
2974
3407
  409: ResourceExistsError,
@@ -3026,7 +3459,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3026
3459
  :rtype: dict[str, ~client.models.LimitedJobStatusReturn]
3027
3460
  :raises ~azure.core.exceptions.HttpResponseError:
3028
3461
  """
3029
- error_map = {
3462
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
3030
3463
  401: ClientAuthenticationError,
3031
3464
  404: ResourceNotFoundError,
3032
3465
  409: ResourceExistsError,
@@ -3151,7 +3584,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3151
3584
  :rtype: dict[str, ~client.models.SetJobStatusReturn]
3152
3585
  :raises ~azure.core.exceptions.HttpResponseError:
3153
3586
  """
3154
- error_map = {
3587
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
3155
3588
  401: ClientAuthenticationError,
3156
3589
  404: ResourceNotFoundError,
3157
3590
  409: ResourceExistsError,
@@ -3224,7 +3657,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3224
3657
  :rtype: dict[str, list[~client.models.JobStatusReturn]]
3225
3658
  :raises ~azure.core.exceptions.HttpResponseError:
3226
3659
  """
3227
- error_map = {
3660
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
3228
3661
  401: ClientAuthenticationError,
3229
3662
  404: ResourceNotFoundError,
3230
3663
  409: ResourceExistsError,