diracx-client 0.0.1a11__py3-none-any.whl → 0.0.1a13__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,30 +1,42 @@
1
- # pylint: disable=too-many-lines
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.1, generator: @autorest/python@6.4.11)
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
 
22
+ from azure.core import MatchConditions
11
23
  from azure.core.exceptions import (
12
24
  ClientAuthenticationError,
13
25
  HttpResponseError,
14
26
  ResourceExistsError,
27
+ ResourceModifiedError,
15
28
  ResourceNotFoundError,
16
29
  ResourceNotModifiedError,
17
30
  map_error,
18
31
  )
19
32
  from azure.core.pipeline import PipelineResponse
20
- from azure.core.pipeline.transport import HttpResponse
21
- from azure.core.rest import HttpRequest
33
+ from azure.core.rest import HttpRequest, HttpResponse
22
34
  from azure.core.tracing.decorator import distributed_trace
23
35
  from azure.core.utils import case_insensitive_dict
24
36
 
25
37
  from .. import models as _models
26
38
  from .._serialization import Serializer
27
- from .._vendor import _format_url_section, raise_if_not_implemented
39
+ from .._vendor import prep_if_match, prep_if_none_match, raise_if_not_implemented
28
40
 
29
41
  if sys.version_info >= (3, 9):
30
42
  from collections.abc import MutableMapping
@@ -93,7 +105,7 @@ def build_auth_do_device_flow_request(*, user_code: str, **kwargs: Any) -> HttpR
93
105
 
94
106
 
95
107
  def build_auth_initiate_device_flow_request(
96
- *, client_id: str, scope: str, audience: str, **kwargs: Any
108
+ *, client_id: str, scope: str, **kwargs: Any
97
109
  ) -> HttpRequest:
98
110
  _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
99
111
  _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
@@ -106,7 +118,6 @@ def build_auth_initiate_device_flow_request(
106
118
  # Construct parameters
107
119
  _params["client_id"] = _SERIALIZER.query("client_id", client_id, "str")
108
120
  _params["scope"] = _SERIALIZER.query("scope", scope, "str")
109
- _params["audience"] = _SERIALIZER.query("audience", audience, "str")
110
121
 
111
122
  # Construct headers
112
123
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -178,7 +189,7 @@ def build_auth_revoke_refresh_token_request(jti: str, **kwargs: Any) -> HttpRequ
178
189
  "jti": _SERIALIZER.url("jti", jti, "str"),
179
190
  }
180
191
 
181
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
192
+ _url: str = _url.format(**path_format_arguments) # type: ignore
182
193
 
183
194
  # Construct headers
184
195
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -186,11 +197,25 @@ def build_auth_revoke_refresh_token_request(jti: str, **kwargs: Any) -> HttpRequ
186
197
  return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs)
187
198
 
188
199
 
200
+ def build_auth_userinfo_request(**kwargs: Any) -> HttpRequest:
201
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
202
+
203
+ accept = _headers.pop("Accept", "application/json")
204
+
205
+ # Construct URL
206
+ _url = "/api/auth/userinfo"
207
+
208
+ # Construct headers
209
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
210
+
211
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
212
+
213
+
189
214
  def build_auth_authorization_flow_request(
190
215
  *,
191
- response_type: Union[str, _models.Enum3],
216
+ response_type: Union[str, _models.Enum0],
192
217
  code_challenge: str,
193
- code_challenge_method: Union[str, _models.Enum4],
218
+ code_challenge_method: Union[str, _models.Enum1],
194
219
  client_id: str,
195
220
  redirect_uri: str,
196
221
  scope: str,
@@ -249,24 +274,11 @@ def build_auth_authorization_flow_complete_request( # pylint: disable=name-too-
249
274
  )
250
275
 
251
276
 
252
- def build_auth_userinfo_request(**kwargs: Any) -> HttpRequest:
253
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
254
-
255
- accept = _headers.pop("Accept", "application/json")
256
-
257
- # Construct URL
258
- _url = "/api/auth/userinfo"
259
-
260
- # Construct headers
261
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
262
-
263
- return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
264
-
265
-
266
277
  def build_config_serve_config_request(
267
278
  *,
268
- if_none_match: Optional[str] = None,
269
279
  if_modified_since: Optional[str] = None,
280
+ etag: Optional[str] = None,
281
+ match_condition: Optional[MatchConditions] = None,
270
282
  **kwargs: Any,
271
283
  ) -> HttpRequest:
272
284
  _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
@@ -277,15 +289,19 @@ def build_config_serve_config_request(
277
289
  _url = "/api/config/"
278
290
 
279
291
  # Construct headers
280
- if if_none_match is not None:
281
- _headers["if-none-match"] = _SERIALIZER.header(
282
- "if_none_match", if_none_match, "str"
283
- )
284
292
  if if_modified_since is not None:
285
293
  _headers["if-modified-since"] = _SERIALIZER.header(
286
294
  "if_modified_since", if_modified_since, "str"
287
295
  )
288
296
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
297
+ if_match = prep_if_match(etag, match_condition)
298
+ if if_match is not None:
299
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
300
+ if_none_match = prep_if_none_match(etag, match_condition)
301
+ if if_none_match is not None:
302
+ _headers["If-None-Match"] = _SERIALIZER.header(
303
+ "if_none_match", if_none_match, "str"
304
+ )
289
305
 
290
306
  return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
291
307
 
@@ -339,6 +355,120 @@ def build_jobs_initiate_sandbox_upload_request(
339
355
  return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs)
340
356
 
341
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
+
342
472
  def build_jobs_submit_bulk_jobs_request(**kwargs: Any) -> HttpRequest:
343
473
  _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
344
474
 
@@ -533,7 +663,7 @@ def build_jobs_reschedule_single_job_request(job_id: int, **kwargs: Any) -> Http
533
663
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
534
664
  }
535
665
 
536
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
666
+ _url: str = _url.format(**path_format_arguments) # type: ignore
537
667
 
538
668
  # Construct headers
539
669
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -605,7 +735,7 @@ def build_jobs_get_single_job_request(job_id: int, **kwargs: Any) -> HttpRequest
605
735
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
606
736
  }
607
737
 
608
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
738
+ _url: str = _url.format(**path_format_arguments) # type: ignore
609
739
 
610
740
  # Construct headers
611
741
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -624,7 +754,7 @@ def build_jobs_delete_single_job_request(job_id: int, **kwargs: Any) -> HttpRequ
624
754
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
625
755
  }
626
756
 
627
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
757
+ _url: str = _url.format(**path_format_arguments) # type: ignore
628
758
 
629
759
  # Construct headers
630
760
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -649,7 +779,7 @@ def build_jobs_set_single_job_properties_request( # pylint: disable=name-too-lo
649
779
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
650
780
  }
651
781
 
652
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
782
+ _url: str = _url.format(**path_format_arguments) # type: ignore
653
783
 
654
784
  # Construct parameters
655
785
  if update_timestamp is not None:
@@ -680,7 +810,7 @@ def build_jobs_kill_single_job_request(job_id: int, **kwargs: Any) -> HttpReques
680
810
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
681
811
  }
682
812
 
683
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
813
+ _url: str = _url.format(**path_format_arguments) # type: ignore
684
814
 
685
815
  # Construct headers
686
816
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -699,7 +829,7 @@ def build_jobs_remove_single_job_request(job_id: int, **kwargs: Any) -> HttpRequ
699
829
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
700
830
  }
701
831
 
702
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
832
+ _url: str = _url.format(**path_format_arguments) # type: ignore
703
833
 
704
834
  # Construct headers
705
835
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -718,7 +848,7 @@ def build_jobs_get_single_job_status_request(job_id: int, **kwargs: Any) -> Http
718
848
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
719
849
  }
720
850
 
721
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
851
+ _url: str = _url.format(**path_format_arguments) # type: ignore
722
852
 
723
853
  # Construct headers
724
854
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -743,7 +873,7 @@ def build_jobs_set_single_job_status_request(
743
873
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
744
874
  }
745
875
 
746
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
876
+ _url: str = _url.format(**path_format_arguments) # type: ignore
747
877
 
748
878
  # Construct parameters
749
879
  if force is not None:
@@ -774,7 +904,7 @@ def build_jobs_get_single_job_status_history_request( # pylint: disable=name-to
774
904
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
775
905
  }
776
906
 
777
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
907
+ _url: str = _url.format(**path_format_arguments) # type: ignore
778
908
 
779
909
  # Construct headers
780
910
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -807,13 +937,13 @@ class WellKnownOperations:
807
937
  def openid_configuration(self, **kwargs: Any) -> Any:
808
938
  """Openid Configuration.
809
939
 
810
- Openid Configuration.
940
+ OpenID Connect discovery endpoint.
811
941
 
812
942
  :return: any
813
943
  :rtype: any
814
944
  :raises ~azure.core.exceptions.HttpResponseError:
815
945
  """
816
- error_map = {
946
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
817
947
  401: ClientAuthenticationError,
818
948
  404: ResourceNotFoundError,
819
949
  409: ResourceExistsError,
@@ -826,22 +956,24 @@ class WellKnownOperations:
826
956
 
827
957
  cls: ClsType[Any] = kwargs.pop("cls", None)
828
958
 
829
- request = build_well_known_openid_configuration_request(
959
+ _request = build_well_known_openid_configuration_request(
830
960
  headers=_headers,
831
961
  params=_params,
832
962
  )
833
- request.url = self._client.format_url(request.url)
963
+ _request.url = self._client.format_url(_request.url)
834
964
 
835
965
  _stream = False
836
966
  pipeline_response: PipelineResponse = (
837
967
  self._client._pipeline.run( # pylint: disable=protected-access
838
- request, stream=_stream, **kwargs
968
+ _request, stream=_stream, **kwargs
839
969
  )
840
970
  )
841
971
 
842
972
  response = pipeline_response.http_response
843
973
 
844
974
  if response.status_code not in [200]:
975
+ if _stream:
976
+ response.read() # Load the body in memory and close the socket
845
977
  map_error(
846
978
  status_code=response.status_code, response=response, error_map=error_map
847
979
  )
@@ -850,21 +982,21 @@ class WellKnownOperations:
850
982
  deserialized = self._deserialize("object", pipeline_response)
851
983
 
852
984
  if cls:
853
- return cls(pipeline_response, deserialized, {})
985
+ return cls(pipeline_response, deserialized, {}) # type: ignore
854
986
 
855
- return deserialized
987
+ return deserialized # type: ignore
856
988
 
857
989
  @distributed_trace
858
990
  def installation_metadata(self, **kwargs: Any) -> _models.Metadata:
859
991
  """Installation Metadata.
860
992
 
861
- Installation Metadata.
993
+ Get metadata about the dirac installation.
862
994
 
863
995
  :return: Metadata
864
996
  :rtype: ~client.models.Metadata
865
997
  :raises ~azure.core.exceptions.HttpResponseError:
866
998
  """
867
- error_map = {
999
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
868
1000
  401: ClientAuthenticationError,
869
1001
  404: ResourceNotFoundError,
870
1002
  409: ResourceExistsError,
@@ -877,22 +1009,24 @@ class WellKnownOperations:
877
1009
 
878
1010
  cls: ClsType[_models.Metadata] = kwargs.pop("cls", None)
879
1011
 
880
- request = build_well_known_installation_metadata_request(
1012
+ _request = build_well_known_installation_metadata_request(
881
1013
  headers=_headers,
882
1014
  params=_params,
883
1015
  )
884
- request.url = self._client.format_url(request.url)
1016
+ _request.url = self._client.format_url(_request.url)
885
1017
 
886
1018
  _stream = False
887
1019
  pipeline_response: PipelineResponse = (
888
1020
  self._client._pipeline.run( # pylint: disable=protected-access
889
- request, stream=_stream, **kwargs
1021
+ _request, stream=_stream, **kwargs
890
1022
  )
891
1023
  )
892
1024
 
893
1025
  response = pipeline_response.http_response
894
1026
 
895
1027
  if response.status_code not in [200]:
1028
+ if _stream:
1029
+ response.read() # Load the body in memory and close the socket
896
1030
  map_error(
897
1031
  status_code=response.status_code, response=response, error_map=error_map
898
1032
  )
@@ -901,12 +1035,12 @@ class WellKnownOperations:
901
1035
  deserialized = self._deserialize("Metadata", pipeline_response)
902
1036
 
903
1037
  if cls:
904
- return cls(pipeline_response, deserialized, {})
1038
+ return cls(pipeline_response, deserialized, {}) # type: ignore
905
1039
 
906
- return deserialized
1040
+ return deserialized # type: ignore
907
1041
 
908
1042
 
909
- class AuthOperations:
1043
+ class AuthOperations: # pylint: disable=abstract-class-instantiated
910
1044
  """
911
1045
  .. warning::
912
1046
  **DO NOT** instantiate this class directly.
@@ -926,6 +1060,7 @@ class AuthOperations:
926
1060
  self._deserialize = (
927
1061
  input_args.pop(0) if input_args else kwargs.pop("deserializer")
928
1062
  )
1063
+
929
1064
  raise_if_not_implemented(
930
1065
  self.__class__,
931
1066
  [
@@ -952,7 +1087,7 @@ class AuthOperations:
952
1087
  :rtype: any
953
1088
  :raises ~azure.core.exceptions.HttpResponseError:
954
1089
  """
955
- error_map = {
1090
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
956
1091
  401: ClientAuthenticationError,
957
1092
  404: ResourceNotFoundError,
958
1093
  409: ResourceExistsError,
@@ -965,23 +1100,25 @@ class AuthOperations:
965
1100
 
966
1101
  cls: ClsType[Any] = kwargs.pop("cls", None)
967
1102
 
968
- request = build_auth_do_device_flow_request(
1103
+ _request = build_auth_do_device_flow_request(
969
1104
  user_code=user_code,
970
1105
  headers=_headers,
971
1106
  params=_params,
972
1107
  )
973
- request.url = self._client.format_url(request.url)
1108
+ _request.url = self._client.format_url(_request.url)
974
1109
 
975
1110
  _stream = False
976
1111
  pipeline_response: PipelineResponse = (
977
1112
  self._client._pipeline.run( # pylint: disable=protected-access
978
- request, stream=_stream, **kwargs
1113
+ _request, stream=_stream, **kwargs
979
1114
  )
980
1115
  )
981
1116
 
982
1117
  response = pipeline_response.http_response
983
1118
 
984
1119
  if response.status_code not in [200]:
1120
+ if _stream:
1121
+ response.read() # Load the body in memory and close the socket
985
1122
  map_error(
986
1123
  status_code=response.status_code, response=response, error_map=error_map
987
1124
  )
@@ -990,13 +1127,13 @@ class AuthOperations:
990
1127
  deserialized = self._deserialize("object", pipeline_response)
991
1128
 
992
1129
  if cls:
993
- return cls(pipeline_response, deserialized, {})
1130
+ return cls(pipeline_response, deserialized, {}) # type: ignore
994
1131
 
995
- return deserialized
1132
+ return deserialized # type: ignore
996
1133
 
997
1134
  @distributed_trace
998
1135
  def initiate_device_flow(
999
- self, *, client_id: str, scope: str, audience: str, **kwargs: Any
1136
+ self, *, client_id: str, scope: str, **kwargs: Any
1000
1137
  ) -> _models.InitiateDeviceFlowResponse:
1001
1138
  """Initiate Device Flow.
1002
1139
 
@@ -1012,13 +1149,11 @@ class AuthOperations:
1012
1149
  :paramtype client_id: str
1013
1150
  :keyword scope: Required.
1014
1151
  :paramtype scope: str
1015
- :keyword audience: Required.
1016
- :paramtype audience: str
1017
1152
  :return: InitiateDeviceFlowResponse
1018
1153
  :rtype: ~client.models.InitiateDeviceFlowResponse
1019
1154
  :raises ~azure.core.exceptions.HttpResponseError:
1020
1155
  """
1021
- error_map = {
1156
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1022
1157
  401: ClientAuthenticationError,
1023
1158
  404: ResourceNotFoundError,
1024
1159
  409: ResourceExistsError,
@@ -1031,25 +1166,26 @@ class AuthOperations:
1031
1166
 
1032
1167
  cls: ClsType[_models.InitiateDeviceFlowResponse] = kwargs.pop("cls", None)
1033
1168
 
1034
- request = build_auth_initiate_device_flow_request(
1169
+ _request = build_auth_initiate_device_flow_request(
1035
1170
  client_id=client_id,
1036
1171
  scope=scope,
1037
- audience=audience,
1038
1172
  headers=_headers,
1039
1173
  params=_params,
1040
1174
  )
1041
- request.url = self._client.format_url(request.url)
1175
+ _request.url = self._client.format_url(_request.url)
1042
1176
 
1043
1177
  _stream = False
1044
1178
  pipeline_response: PipelineResponse = (
1045
1179
  self._client._pipeline.run( # pylint: disable=protected-access
1046
- request, stream=_stream, **kwargs
1180
+ _request, stream=_stream, **kwargs
1047
1181
  )
1048
1182
  )
1049
1183
 
1050
1184
  response = pipeline_response.http_response
1051
1185
 
1052
1186
  if response.status_code not in [200]:
1187
+ if _stream:
1188
+ response.read() # Load the body in memory and close the socket
1053
1189
  map_error(
1054
1190
  status_code=response.status_code, response=response, error_map=error_map
1055
1191
  )
@@ -1060,9 +1196,9 @@ class AuthOperations:
1060
1196
  )
1061
1197
 
1062
1198
  if cls:
1063
- return cls(pipeline_response, deserialized, {})
1199
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1064
1200
 
1065
- return deserialized
1201
+ return deserialized # type: ignore
1066
1202
 
1067
1203
  @distributed_trace
1068
1204
  def finish_device_flow(self, *, code: str, state: str, **kwargs: Any) -> Any:
@@ -1082,7 +1218,7 @@ class AuthOperations:
1082
1218
  :rtype: any
1083
1219
  :raises ~azure.core.exceptions.HttpResponseError:
1084
1220
  """
1085
- error_map = {
1221
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1086
1222
  401: ClientAuthenticationError,
1087
1223
  404: ResourceNotFoundError,
1088
1224
  409: ResourceExistsError,
@@ -1095,24 +1231,26 @@ class AuthOperations:
1095
1231
 
1096
1232
  cls: ClsType[Any] = kwargs.pop("cls", None)
1097
1233
 
1098
- request = build_auth_finish_device_flow_request(
1234
+ _request = build_auth_finish_device_flow_request(
1099
1235
  code=code,
1100
1236
  state=state,
1101
1237
  headers=_headers,
1102
1238
  params=_params,
1103
1239
  )
1104
- request.url = self._client.format_url(request.url)
1240
+ _request.url = self._client.format_url(_request.url)
1105
1241
 
1106
1242
  _stream = False
1107
1243
  pipeline_response: PipelineResponse = (
1108
1244
  self._client._pipeline.run( # pylint: disable=protected-access
1109
- request, stream=_stream, **kwargs
1245
+ _request, stream=_stream, **kwargs
1110
1246
  )
1111
1247
  )
1112
1248
 
1113
1249
  response = pipeline_response.http_response
1114
1250
 
1115
1251
  if response.status_code not in [200]:
1252
+ if _stream:
1253
+ response.read() # Load the body in memory and close the socket
1116
1254
  map_error(
1117
1255
  status_code=response.status_code, response=response, error_map=error_map
1118
1256
  )
@@ -1121,21 +1259,21 @@ class AuthOperations:
1121
1259
  deserialized = self._deserialize("object", pipeline_response)
1122
1260
 
1123
1261
  if cls:
1124
- return cls(pipeline_response, deserialized, {})
1262
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1125
1263
 
1126
- return deserialized
1264
+ return deserialized # type: ignore
1127
1265
 
1128
1266
  @distributed_trace
1129
1267
  def finished(self, **kwargs: Any) -> Any:
1130
1268
  """Finished.
1131
1269
 
1132
- Finished.
1270
+ This is the final step of the device flow.
1133
1271
 
1134
1272
  :return: any
1135
1273
  :rtype: any
1136
1274
  :raises ~azure.core.exceptions.HttpResponseError:
1137
1275
  """
1138
- error_map = {
1276
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1139
1277
  401: ClientAuthenticationError,
1140
1278
  404: ResourceNotFoundError,
1141
1279
  409: ResourceExistsError,
@@ -1148,22 +1286,24 @@ class AuthOperations:
1148
1286
 
1149
1287
  cls: ClsType[Any] = kwargs.pop("cls", None)
1150
1288
 
1151
- request = build_auth_finished_request(
1289
+ _request = build_auth_finished_request(
1152
1290
  headers=_headers,
1153
1291
  params=_params,
1154
1292
  )
1155
- request.url = self._client.format_url(request.url)
1293
+ _request.url = self._client.format_url(_request.url)
1156
1294
 
1157
1295
  _stream = False
1158
1296
  pipeline_response: PipelineResponse = (
1159
1297
  self._client._pipeline.run( # pylint: disable=protected-access
1160
- request, stream=_stream, **kwargs
1298
+ _request, stream=_stream, **kwargs
1161
1299
  )
1162
1300
  )
1163
1301
 
1164
1302
  response = pipeline_response.http_response
1165
1303
 
1166
1304
  if response.status_code not in [200]:
1305
+ if _stream:
1306
+ response.read() # Load the body in memory and close the socket
1167
1307
  map_error(
1168
1308
  status_code=response.status_code, response=response, error_map=error_map
1169
1309
  )
@@ -1172,21 +1312,22 @@ class AuthOperations:
1172
1312
  deserialized = self._deserialize("object", pipeline_response)
1173
1313
 
1174
1314
  if cls:
1175
- return cls(pipeline_response, deserialized, {})
1315
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1176
1316
 
1177
- return deserialized
1317
+ return deserialized # type: ignore
1178
1318
 
1179
1319
  @distributed_trace
1180
1320
  def get_refresh_tokens(self, **kwargs: Any) -> List[Any]:
1181
1321
  """Get Refresh Tokens.
1182
1322
 
1183
- Get Refresh Tokens.
1323
+ Get all refresh tokens for the user. If the user has the ``proxy_management`` property, then
1324
+ the subject is not used to filter the refresh tokens.
1184
1325
 
1185
1326
  :return: list of any
1186
1327
  :rtype: list[any]
1187
1328
  :raises ~azure.core.exceptions.HttpResponseError:
1188
1329
  """
1189
- error_map = {
1330
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1190
1331
  401: ClientAuthenticationError,
1191
1332
  404: ResourceNotFoundError,
1192
1333
  409: ResourceExistsError,
@@ -1199,22 +1340,24 @@ class AuthOperations:
1199
1340
 
1200
1341
  cls: ClsType[List[Any]] = kwargs.pop("cls", None)
1201
1342
 
1202
- request = build_auth_get_refresh_tokens_request(
1343
+ _request = build_auth_get_refresh_tokens_request(
1203
1344
  headers=_headers,
1204
1345
  params=_params,
1205
1346
  )
1206
- request.url = self._client.format_url(request.url)
1347
+ _request.url = self._client.format_url(_request.url)
1207
1348
 
1208
1349
  _stream = False
1209
1350
  pipeline_response: PipelineResponse = (
1210
1351
  self._client._pipeline.run( # pylint: disable=protected-access
1211
- request, stream=_stream, **kwargs
1352
+ _request, stream=_stream, **kwargs
1212
1353
  )
1213
1354
  )
1214
1355
 
1215
1356
  response = pipeline_response.http_response
1216
1357
 
1217
1358
  if response.status_code not in [200]:
1359
+ if _stream:
1360
+ response.read() # Load the body in memory and close the socket
1218
1361
  map_error(
1219
1362
  status_code=response.status_code, response=response, error_map=error_map
1220
1363
  )
@@ -1223,15 +1366,16 @@ class AuthOperations:
1223
1366
  deserialized = self._deserialize("[object]", pipeline_response)
1224
1367
 
1225
1368
  if cls:
1226
- return cls(pipeline_response, deserialized, {})
1369
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1227
1370
 
1228
- return deserialized
1371
+ return deserialized # type: ignore
1229
1372
 
1230
1373
  @distributed_trace
1231
1374
  def revoke_refresh_token(self, jti: str, **kwargs: Any) -> str:
1232
1375
  """Revoke Refresh Token.
1233
1376
 
1234
- Revoke Refresh Token.
1377
+ Revoke a refresh token. If the user has the ``proxy_management`` property, then
1378
+ the subject is not used to filter the refresh tokens.
1235
1379
 
1236
1380
  :param jti: Required.
1237
1381
  :type jti: str
@@ -1239,7 +1383,7 @@ class AuthOperations:
1239
1383
  :rtype: str
1240
1384
  :raises ~azure.core.exceptions.HttpResponseError:
1241
1385
  """
1242
- error_map = {
1386
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1243
1387
  401: ClientAuthenticationError,
1244
1388
  404: ResourceNotFoundError,
1245
1389
  409: ResourceExistsError,
@@ -1252,23 +1396,25 @@ class AuthOperations:
1252
1396
 
1253
1397
  cls: ClsType[str] = kwargs.pop("cls", None)
1254
1398
 
1255
- request = build_auth_revoke_refresh_token_request(
1399
+ _request = build_auth_revoke_refresh_token_request(
1256
1400
  jti=jti,
1257
1401
  headers=_headers,
1258
1402
  params=_params,
1259
1403
  )
1260
- request.url = self._client.format_url(request.url)
1404
+ _request.url = self._client.format_url(_request.url)
1261
1405
 
1262
1406
  _stream = False
1263
1407
  pipeline_response: PipelineResponse = (
1264
1408
  self._client._pipeline.run( # pylint: disable=protected-access
1265
- request, stream=_stream, **kwargs
1409
+ _request, stream=_stream, **kwargs
1266
1410
  )
1267
1411
  )
1268
1412
 
1269
1413
  response = pipeline_response.http_response
1270
1414
 
1271
1415
  if response.status_code not in [200]:
1416
+ if _stream:
1417
+ response.read() # Load the body in memory and close the socket
1272
1418
  map_error(
1273
1419
  status_code=response.status_code, response=response, error_map=error_map
1274
1420
  )
@@ -1277,17 +1423,70 @@ class AuthOperations:
1277
1423
  deserialized = self._deserialize("str", pipeline_response)
1278
1424
 
1279
1425
  if cls:
1280
- return cls(pipeline_response, deserialized, {})
1426
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1427
+
1428
+ return deserialized # type: ignore
1429
+
1430
+ @distributed_trace
1431
+ def userinfo(self, **kwargs: Any) -> _models.UserInfoResponse:
1432
+ """Userinfo.
1433
+
1434
+ Get information about the user's identity.
1435
+
1436
+ :return: UserInfoResponse
1437
+ :rtype: ~client.models.UserInfoResponse
1438
+ :raises ~azure.core.exceptions.HttpResponseError:
1439
+ """
1440
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1441
+ 401: ClientAuthenticationError,
1442
+ 404: ResourceNotFoundError,
1443
+ 409: ResourceExistsError,
1444
+ 304: ResourceNotModifiedError,
1445
+ }
1446
+ error_map.update(kwargs.pop("error_map", {}) or {})
1447
+
1448
+ _headers = kwargs.pop("headers", {}) or {}
1449
+ _params = kwargs.pop("params", {}) or {}
1450
+
1451
+ cls: ClsType[_models.UserInfoResponse] = kwargs.pop("cls", None)
1452
+
1453
+ _request = build_auth_userinfo_request(
1454
+ headers=_headers,
1455
+ params=_params,
1456
+ )
1457
+ _request.url = self._client.format_url(_request.url)
1458
+
1459
+ _stream = False
1460
+ pipeline_response: PipelineResponse = (
1461
+ self._client._pipeline.run( # pylint: disable=protected-access
1462
+ _request, stream=_stream, **kwargs
1463
+ )
1464
+ )
1465
+
1466
+ response = pipeline_response.http_response
1467
+
1468
+ if response.status_code not in [200]:
1469
+ if _stream:
1470
+ response.read() # Load the body in memory and close the socket
1471
+ map_error(
1472
+ status_code=response.status_code, response=response, error_map=error_map
1473
+ )
1474
+ raise HttpResponseError(response=response)
1475
+
1476
+ deserialized = self._deserialize("UserInfoResponse", pipeline_response)
1477
+
1478
+ if cls:
1479
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1281
1480
 
1282
- return deserialized
1481
+ return deserialized # type: ignore
1283
1482
 
1284
1483
  @distributed_trace
1285
1484
  def authorization_flow(
1286
1485
  self,
1287
1486
  *,
1288
- response_type: Union[str, _models.Enum3],
1487
+ response_type: Union[str, _models.Enum0],
1289
1488
  code_challenge: str,
1290
- code_challenge_method: Union[str, _models.Enum4],
1489
+ code_challenge_method: Union[str, _models.Enum1],
1291
1490
  client_id: str,
1292
1491
  redirect_uri: str,
1293
1492
  scope: str,
@@ -1296,14 +1495,20 @@ class AuthOperations:
1296
1495
  ) -> Any:
1297
1496
  """Authorization Flow.
1298
1497
 
1299
- 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.
1300
1505
 
1301
1506
  :keyword response_type: "code" Required.
1302
- :paramtype response_type: str or ~client.models.Enum3
1507
+ :paramtype response_type: str or ~client.models.Enum0
1303
1508
  :keyword code_challenge: Required.
1304
1509
  :paramtype code_challenge: str
1305
1510
  :keyword code_challenge_method: "S256" Required.
1306
- :paramtype code_challenge_method: str or ~client.models.Enum4
1511
+ :paramtype code_challenge_method: str or ~client.models.Enum1
1307
1512
  :keyword client_id: Required.
1308
1513
  :paramtype client_id: str
1309
1514
  :keyword redirect_uri: Required.
@@ -1316,7 +1521,7 @@ class AuthOperations:
1316
1521
  :rtype: any
1317
1522
  :raises ~azure.core.exceptions.HttpResponseError:
1318
1523
  """
1319
- error_map = {
1524
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1320
1525
  401: ClientAuthenticationError,
1321
1526
  404: ResourceNotFoundError,
1322
1527
  409: ResourceExistsError,
@@ -1329,7 +1534,7 @@ class AuthOperations:
1329
1534
 
1330
1535
  cls: ClsType[Any] = kwargs.pop("cls", None)
1331
1536
 
1332
- request = build_auth_authorization_flow_request(
1537
+ _request = build_auth_authorization_flow_request(
1333
1538
  response_type=response_type,
1334
1539
  code_challenge=code_challenge,
1335
1540
  code_challenge_method=code_challenge_method,
@@ -1340,18 +1545,20 @@ class AuthOperations:
1340
1545
  headers=_headers,
1341
1546
  params=_params,
1342
1547
  )
1343
- request.url = self._client.format_url(request.url)
1548
+ _request.url = self._client.format_url(_request.url)
1344
1549
 
1345
1550
  _stream = False
1346
1551
  pipeline_response: PipelineResponse = (
1347
1552
  self._client._pipeline.run( # pylint: disable=protected-access
1348
- request, stream=_stream, **kwargs
1553
+ _request, stream=_stream, **kwargs
1349
1554
  )
1350
1555
  )
1351
1556
 
1352
1557
  response = pipeline_response.http_response
1353
1558
 
1354
1559
  if response.status_code not in [200]:
1560
+ if _stream:
1561
+ response.read() # Load the body in memory and close the socket
1355
1562
  map_error(
1356
1563
  status_code=response.status_code, response=response, error_map=error_map
1357
1564
  )
@@ -1360,9 +1567,9 @@ class AuthOperations:
1360
1567
  deserialized = self._deserialize("object", pipeline_response)
1361
1568
 
1362
1569
  if cls:
1363
- return cls(pipeline_response, deserialized, {})
1570
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1364
1571
 
1365
- return deserialized
1572
+ return deserialized # type: ignore
1366
1573
 
1367
1574
  @distributed_trace
1368
1575
  def authorization_flow_complete(
@@ -1370,7 +1577,13 @@ class AuthOperations:
1370
1577
  ) -> Any:
1371
1578
  """Authorization Flow Complete.
1372
1579
 
1373
- 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.
1374
1587
 
1375
1588
  :keyword code: Required.
1376
1589
  :paramtype code: str
@@ -1380,7 +1593,7 @@ class AuthOperations:
1380
1593
  :rtype: any
1381
1594
  :raises ~azure.core.exceptions.HttpResponseError:
1382
1595
  """
1383
- error_map = {
1596
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1384
1597
  401: ClientAuthenticationError,
1385
1598
  404: ResourceNotFoundError,
1386
1599
  409: ResourceExistsError,
@@ -1393,24 +1606,26 @@ class AuthOperations:
1393
1606
 
1394
1607
  cls: ClsType[Any] = kwargs.pop("cls", None)
1395
1608
 
1396
- request = build_auth_authorization_flow_complete_request(
1609
+ _request = build_auth_authorization_flow_complete_request(
1397
1610
  code=code,
1398
1611
  state=state,
1399
1612
  headers=_headers,
1400
1613
  params=_params,
1401
1614
  )
1402
- request.url = self._client.format_url(request.url)
1615
+ _request.url = self._client.format_url(_request.url)
1403
1616
 
1404
1617
  _stream = False
1405
1618
  pipeline_response: PipelineResponse = (
1406
1619
  self._client._pipeline.run( # pylint: disable=protected-access
1407
- request, stream=_stream, **kwargs
1620
+ _request, stream=_stream, **kwargs
1408
1621
  )
1409
1622
  )
1410
1623
 
1411
1624
  response = pipeline_response.http_response
1412
1625
 
1413
1626
  if response.status_code not in [200]:
1627
+ if _stream:
1628
+ response.read() # Load the body in memory and close the socket
1414
1629
  map_error(
1415
1630
  status_code=response.status_code, response=response, error_map=error_map
1416
1631
  )
@@ -1419,60 +1634,9 @@ class AuthOperations:
1419
1634
  deserialized = self._deserialize("object", pipeline_response)
1420
1635
 
1421
1636
  if cls:
1422
- return cls(pipeline_response, deserialized, {})
1637
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1423
1638
 
1424
- return deserialized
1425
-
1426
- @distributed_trace
1427
- def userinfo(self, **kwargs: Any) -> _models.UserInfoResponse:
1428
- """Userinfo.
1429
-
1430
- Userinfo.
1431
-
1432
- :return: UserInfoResponse
1433
- :rtype: ~client.models.UserInfoResponse
1434
- :raises ~azure.core.exceptions.HttpResponseError:
1435
- """
1436
- error_map = {
1437
- 401: ClientAuthenticationError,
1438
- 404: ResourceNotFoundError,
1439
- 409: ResourceExistsError,
1440
- 304: ResourceNotModifiedError,
1441
- }
1442
- error_map.update(kwargs.pop("error_map", {}) or {})
1443
-
1444
- _headers = kwargs.pop("headers", {}) or {}
1445
- _params = kwargs.pop("params", {}) or {}
1446
-
1447
- cls: ClsType[_models.UserInfoResponse] = kwargs.pop("cls", None)
1448
-
1449
- request = build_auth_userinfo_request(
1450
- headers=_headers,
1451
- params=_params,
1452
- )
1453
- request.url = self._client.format_url(request.url)
1454
-
1455
- _stream = False
1456
- pipeline_response: PipelineResponse = (
1457
- self._client._pipeline.run( # pylint: disable=protected-access
1458
- request, stream=_stream, **kwargs
1459
- )
1460
- )
1461
-
1462
- response = pipeline_response.http_response
1463
-
1464
- if response.status_code not in [200]:
1465
- map_error(
1466
- status_code=response.status_code, response=response, error_map=error_map
1467
- )
1468
- raise HttpResponseError(response=response)
1469
-
1470
- deserialized = self._deserialize("UserInfoResponse", pipeline_response)
1471
-
1472
- if cls:
1473
- return cls(pipeline_response, deserialized, {})
1474
-
1475
- return deserialized
1639
+ return deserialized # type: ignore
1476
1640
 
1477
1641
 
1478
1642
  class ConfigOperations:
@@ -1500,8 +1664,9 @@ class ConfigOperations:
1500
1664
  def serve_config(
1501
1665
  self,
1502
1666
  *,
1503
- if_none_match: Optional[str] = None,
1504
1667
  if_modified_since: Optional[str] = None,
1668
+ etag: Optional[str] = None,
1669
+ match_condition: Optional[MatchConditions] = None,
1505
1670
  **kwargs: Any,
1506
1671
  ) -> Any:
1507
1672
  """Serve Config.
@@ -1513,20 +1678,29 @@ class ConfigOperations:
1513
1678
  If If-Modified-Since is given and is newer than latest,
1514
1679
  return 304: this is to avoid flip/flopping.
1515
1680
 
1516
- :keyword if_none_match: Default value is None.
1517
- :paramtype if_none_match: str
1518
1681
  :keyword if_modified_since: Default value is None.
1519
1682
  :paramtype if_modified_since: str
1683
+ :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is
1684
+ None.
1685
+ :paramtype etag: str
1686
+ :keyword match_condition: The match condition to use upon the etag. Default value is None.
1687
+ :paramtype match_condition: ~azure.core.MatchConditions
1520
1688
  :return: any
1521
1689
  :rtype: any
1522
1690
  :raises ~azure.core.exceptions.HttpResponseError:
1523
1691
  """
1524
- error_map = {
1692
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1525
1693
  401: ClientAuthenticationError,
1526
1694
  404: ResourceNotFoundError,
1527
1695
  409: ResourceExistsError,
1528
1696
  304: ResourceNotModifiedError,
1529
1697
  }
1698
+ if match_condition == MatchConditions.IfNotModified:
1699
+ error_map[412] = ResourceModifiedError
1700
+ elif match_condition == MatchConditions.IfPresent:
1701
+ error_map[412] = ResourceNotFoundError
1702
+ elif match_condition == MatchConditions.IfMissing:
1703
+ error_map[412] = ResourceExistsError
1530
1704
  error_map.update(kwargs.pop("error_map", {}) or {})
1531
1705
 
1532
1706
  _headers = kwargs.pop("headers", {}) or {}
@@ -1534,24 +1708,27 @@ class ConfigOperations:
1534
1708
 
1535
1709
  cls: ClsType[Any] = kwargs.pop("cls", None)
1536
1710
 
1537
- request = build_config_serve_config_request(
1538
- if_none_match=if_none_match,
1711
+ _request = build_config_serve_config_request(
1539
1712
  if_modified_since=if_modified_since,
1713
+ etag=etag,
1714
+ match_condition=match_condition,
1540
1715
  headers=_headers,
1541
1716
  params=_params,
1542
1717
  )
1543
- request.url = self._client.format_url(request.url)
1718
+ _request.url = self._client.format_url(_request.url)
1544
1719
 
1545
1720
  _stream = False
1546
1721
  pipeline_response: PipelineResponse = (
1547
1722
  self._client._pipeline.run( # pylint: disable=protected-access
1548
- request, stream=_stream, **kwargs
1723
+ _request, stream=_stream, **kwargs
1549
1724
  )
1550
1725
  )
1551
1726
 
1552
1727
  response = pipeline_response.http_response
1553
1728
 
1554
1729
  if response.status_code not in [200]:
1730
+ if _stream:
1731
+ response.read() # Load the body in memory and close the socket
1555
1732
  map_error(
1556
1733
  status_code=response.status_code, response=response, error_map=error_map
1557
1734
  )
@@ -1560,9 +1737,9 @@ class ConfigOperations:
1560
1737
  deserialized = self._deserialize("object", pipeline_response)
1561
1738
 
1562
1739
  if cls:
1563
- return cls(pipeline_response, deserialized, {})
1740
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1564
1741
 
1565
- return deserialized
1742
+ return deserialized # type: ignore
1566
1743
 
1567
1744
 
1568
1745
  class JobsOperations: # pylint: disable=too-many-public-methods
@@ -1606,7 +1783,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1606
1783
  :rtype: ~client.models.SandboxDownloadResponse
1607
1784
  :raises ~azure.core.exceptions.HttpResponseError:
1608
1785
  """
1609
- error_map = {
1786
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1610
1787
  401: ClientAuthenticationError,
1611
1788
  404: ResourceNotFoundError,
1612
1789
  409: ResourceExistsError,
@@ -1619,23 +1796,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1619
1796
 
1620
1797
  cls: ClsType[_models.SandboxDownloadResponse] = kwargs.pop("cls", None)
1621
1798
 
1622
- request = build_jobs_get_sandbox_file_request(
1799
+ _request = build_jobs_get_sandbox_file_request(
1623
1800
  pfn=pfn,
1624
1801
  headers=_headers,
1625
1802
  params=_params,
1626
1803
  )
1627
- request.url = self._client.format_url(request.url)
1804
+ _request.url = self._client.format_url(_request.url)
1628
1805
 
1629
1806
  _stream = False
1630
1807
  pipeline_response: PipelineResponse = (
1631
1808
  self._client._pipeline.run( # pylint: disable=protected-access
1632
- request, stream=_stream, **kwargs
1809
+ _request, stream=_stream, **kwargs
1633
1810
  )
1634
1811
  )
1635
1812
 
1636
1813
  response = pipeline_response.http_response
1637
1814
 
1638
1815
  if response.status_code not in [200]:
1816
+ if _stream:
1817
+ response.read() # Load the body in memory and close the socket
1639
1818
  map_error(
1640
1819
  status_code=response.status_code, response=response, error_map=error_map
1641
1820
  )
@@ -1644,9 +1823,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1644
1823
  deserialized = self._deserialize("SandboxDownloadResponse", pipeline_response)
1645
1824
 
1646
1825
  if cls:
1647
- return cls(pipeline_response, deserialized, {})
1826
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1648
1827
 
1649
- return deserialized
1828
+ return deserialized # type: ignore
1650
1829
 
1651
1830
  @overload
1652
1831
  def initiate_sandbox_upload(
@@ -1678,7 +1857,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1678
1857
 
1679
1858
  @overload
1680
1859
  def initiate_sandbox_upload(
1681
- self, body: IO, *, content_type: str = "application/json", **kwargs: Any
1860
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
1682
1861
  ) -> _models.SandboxUploadResponse:
1683
1862
  """Initiate Sandbox Upload.
1684
1863
 
@@ -1691,7 +1870,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1691
1870
  should be used to upload the sandbox to the storage backend.
1692
1871
 
1693
1872
  :param body: Required.
1694
- :type body: IO
1873
+ :type body: IO[bytes]
1695
1874
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1696
1875
  Default value is "application/json".
1697
1876
  :paramtype content_type: str
@@ -1702,7 +1881,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1702
1881
 
1703
1882
  @distributed_trace
1704
1883
  def initiate_sandbox_upload(
1705
- self, body: Union[_models.SandboxInfo, IO], **kwargs: Any
1884
+ self, body: Union[_models.SandboxInfo, IO[bytes]], **kwargs: Any
1706
1885
  ) -> _models.SandboxUploadResponse:
1707
1886
  """Initiate Sandbox Upload.
1708
1887
 
@@ -1714,16 +1893,13 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1714
1893
  If the sandbox does not exist in the database then the "url" and "fields"
1715
1894
  should be used to upload the sandbox to the storage backend.
1716
1895
 
1717
- :param body: Is either a SandboxInfo type or a IO type. Required.
1718
- :type body: ~client.models.SandboxInfo or IO
1719
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
1720
- Default value is None.
1721
- :paramtype content_type: str
1896
+ :param body: Is either a SandboxInfo type or a IO[bytes] type. Required.
1897
+ :type body: ~client.models.SandboxInfo or IO[bytes]
1722
1898
  :return: SandboxUploadResponse
1723
1899
  :rtype: ~client.models.SandboxUploadResponse
1724
1900
  :raises ~azure.core.exceptions.HttpResponseError:
1725
1901
  """
1726
- error_map = {
1902
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1727
1903
  401: ClientAuthenticationError,
1728
1904
  404: ResourceNotFoundError,
1729
1905
  409: ResourceExistsError,
@@ -1747,25 +1923,27 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1747
1923
  else:
1748
1924
  _json = self._serialize.body(body, "SandboxInfo")
1749
1925
 
1750
- request = build_jobs_initiate_sandbox_upload_request(
1926
+ _request = build_jobs_initiate_sandbox_upload_request(
1751
1927
  content_type=content_type,
1752
1928
  json=_json,
1753
1929
  content=_content,
1754
1930
  headers=_headers,
1755
1931
  params=_params,
1756
1932
  )
1757
- request.url = self._client.format_url(request.url)
1933
+ _request.url = self._client.format_url(_request.url)
1758
1934
 
1759
1935
  _stream = False
1760
1936
  pipeline_response: PipelineResponse = (
1761
1937
  self._client._pipeline.run( # pylint: disable=protected-access
1762
- request, stream=_stream, **kwargs
1938
+ _request, stream=_stream, **kwargs
1763
1939
  )
1764
1940
  )
1765
1941
 
1766
1942
  response = pipeline_response.http_response
1767
1943
 
1768
1944
  if response.status_code not in [200]:
1945
+ if _stream:
1946
+ response.read() # Load the body in memory and close the socket
1769
1947
  map_error(
1770
1948
  status_code=response.status_code, response=response, error_map=error_map
1771
1949
  )
@@ -1774,9 +1952,305 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1774
1952
  deserialized = self._deserialize("SandboxUploadResponse", pipeline_response)
1775
1953
 
1776
1954
  if cls:
1777
- return cls(pipeline_response, deserialized, {})
1955
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1956
+
1957
+ return deserialized # type: ignore
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
1778
2014
 
1779
- return deserialized
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
1780
2254
 
1781
2255
  @overload
1782
2256
  def submit_bulk_jobs(
@@ -1798,14 +2272,14 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1798
2272
 
1799
2273
  @overload
1800
2274
  def submit_bulk_jobs(
1801
- self, body: IO, *, content_type: str = "application/json", **kwargs: Any
2275
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
1802
2276
  ) -> List[_models.InsertedJob]:
1803
2277
  """Submit Bulk Jobs.
1804
2278
 
1805
2279
  Submit Bulk Jobs.
1806
2280
 
1807
2281
  :param body: Required.
1808
- :type body: IO
2282
+ :type body: IO[bytes]
1809
2283
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1810
2284
  Default value is "application/json".
1811
2285
  :paramtype content_type: str
@@ -1816,22 +2290,19 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1816
2290
 
1817
2291
  @distributed_trace
1818
2292
  def submit_bulk_jobs(
1819
- self, body: Union[List[str], IO], **kwargs: Any
2293
+ self, body: Union[List[str], IO[bytes]], **kwargs: Any
1820
2294
  ) -> List[_models.InsertedJob]:
1821
2295
  """Submit Bulk Jobs.
1822
2296
 
1823
2297
  Submit Bulk Jobs.
1824
2298
 
1825
- :param body: Is either a [str] type or a IO type. Required.
1826
- :type body: list[str] or IO
1827
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
1828
- Default value is None.
1829
- :paramtype content_type: str
2299
+ :param body: Is either a [str] type or a IO[bytes] type. Required.
2300
+ :type body: list[str] or IO[bytes]
1830
2301
  :return: list of InsertedJob
1831
2302
  :rtype: list[~client.models.InsertedJob]
1832
2303
  :raises ~azure.core.exceptions.HttpResponseError:
1833
2304
  """
1834
- error_map = {
2305
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1835
2306
  401: ClientAuthenticationError,
1836
2307
  404: ResourceNotFoundError,
1837
2308
  409: ResourceExistsError,
@@ -1855,25 +2326,27 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1855
2326
  else:
1856
2327
  _json = self._serialize.body(body, "[str]")
1857
2328
 
1858
- request = build_jobs_submit_bulk_jobs_request(
2329
+ _request = build_jobs_submit_bulk_jobs_request(
1859
2330
  content_type=content_type,
1860
2331
  json=_json,
1861
2332
  content=_content,
1862
2333
  headers=_headers,
1863
2334
  params=_params,
1864
2335
  )
1865
- request.url = self._client.format_url(request.url)
2336
+ _request.url = self._client.format_url(_request.url)
1866
2337
 
1867
2338
  _stream = False
1868
2339
  pipeline_response: PipelineResponse = (
1869
2340
  self._client._pipeline.run( # pylint: disable=protected-access
1870
- request, stream=_stream, **kwargs
2341
+ _request, stream=_stream, **kwargs
1871
2342
  )
1872
2343
  )
1873
2344
 
1874
2345
  response = pipeline_response.http_response
1875
2346
 
1876
2347
  if response.status_code not in [200]:
2348
+ if _stream:
2349
+ response.read() # Load the body in memory and close the socket
1877
2350
  map_error(
1878
2351
  status_code=response.status_code, response=response, error_map=error_map
1879
2352
  )
@@ -1882,9 +2355,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1882
2355
  deserialized = self._deserialize("[InsertedJob]", pipeline_response)
1883
2356
 
1884
2357
  if cls:
1885
- return cls(pipeline_response, deserialized, {})
2358
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1886
2359
 
1887
- return deserialized
2360
+ return deserialized # type: ignore
1888
2361
 
1889
2362
  @distributed_trace
1890
2363
  def delete_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
@@ -1898,7 +2371,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1898
2371
  :rtype: any
1899
2372
  :raises ~azure.core.exceptions.HttpResponseError:
1900
2373
  """
1901
- error_map = {
2374
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1902
2375
  401: ClientAuthenticationError,
1903
2376
  404: ResourceNotFoundError,
1904
2377
  409: ResourceExistsError,
@@ -1911,23 +2384,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1911
2384
 
1912
2385
  cls: ClsType[Any] = kwargs.pop("cls", None)
1913
2386
 
1914
- request = build_jobs_delete_bulk_jobs_request(
2387
+ _request = build_jobs_delete_bulk_jobs_request(
1915
2388
  job_ids=job_ids,
1916
2389
  headers=_headers,
1917
2390
  params=_params,
1918
2391
  )
1919
- request.url = self._client.format_url(request.url)
2392
+ _request.url = self._client.format_url(_request.url)
1920
2393
 
1921
2394
  _stream = False
1922
2395
  pipeline_response: PipelineResponse = (
1923
2396
  self._client._pipeline.run( # pylint: disable=protected-access
1924
- request, stream=_stream, **kwargs
2397
+ _request, stream=_stream, **kwargs
1925
2398
  )
1926
2399
  )
1927
2400
 
1928
2401
  response = pipeline_response.http_response
1929
2402
 
1930
2403
  if response.status_code not in [200]:
2404
+ if _stream:
2405
+ response.read() # Load the body in memory and close the socket
1931
2406
  map_error(
1932
2407
  status_code=response.status_code, response=response, error_map=error_map
1933
2408
  )
@@ -1936,9 +2411,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1936
2411
  deserialized = self._deserialize("object", pipeline_response)
1937
2412
 
1938
2413
  if cls:
1939
- return cls(pipeline_response, deserialized, {})
2414
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1940
2415
 
1941
- return deserialized
2416
+ return deserialized # type: ignore
1942
2417
 
1943
2418
  @distributed_trace
1944
2419
  def kill_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
@@ -1952,7 +2427,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1952
2427
  :rtype: any
1953
2428
  :raises ~azure.core.exceptions.HttpResponseError:
1954
2429
  """
1955
- error_map = {
2430
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1956
2431
  401: ClientAuthenticationError,
1957
2432
  404: ResourceNotFoundError,
1958
2433
  409: ResourceExistsError,
@@ -1965,23 +2440,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1965
2440
 
1966
2441
  cls: ClsType[Any] = kwargs.pop("cls", None)
1967
2442
 
1968
- request = build_jobs_kill_bulk_jobs_request(
2443
+ _request = build_jobs_kill_bulk_jobs_request(
1969
2444
  job_ids=job_ids,
1970
2445
  headers=_headers,
1971
2446
  params=_params,
1972
2447
  )
1973
- request.url = self._client.format_url(request.url)
2448
+ _request.url = self._client.format_url(_request.url)
1974
2449
 
1975
2450
  _stream = False
1976
2451
  pipeline_response: PipelineResponse = (
1977
2452
  self._client._pipeline.run( # pylint: disable=protected-access
1978
- request, stream=_stream, **kwargs
2453
+ _request, stream=_stream, **kwargs
1979
2454
  )
1980
2455
  )
1981
2456
 
1982
2457
  response = pipeline_response.http_response
1983
2458
 
1984
2459
  if response.status_code not in [200]:
2460
+ if _stream:
2461
+ response.read() # Load the body in memory and close the socket
1985
2462
  map_error(
1986
2463
  status_code=response.status_code, response=response, error_map=error_map
1987
2464
  )
@@ -1990,9 +2467,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1990
2467
  deserialized = self._deserialize("object", pipeline_response)
1991
2468
 
1992
2469
  if cls:
1993
- return cls(pipeline_response, deserialized, {})
2470
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1994
2471
 
1995
- return deserialized
2472
+ return deserialized # type: ignore
1996
2473
 
1997
2474
  @distributed_trace
1998
2475
  def remove_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
@@ -2010,7 +2487,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2010
2487
  :rtype: any
2011
2488
  :raises ~azure.core.exceptions.HttpResponseError:
2012
2489
  """
2013
- error_map = {
2490
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2014
2491
  401: ClientAuthenticationError,
2015
2492
  404: ResourceNotFoundError,
2016
2493
  409: ResourceExistsError,
@@ -2023,23 +2500,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2023
2500
 
2024
2501
  cls: ClsType[Any] = kwargs.pop("cls", None)
2025
2502
 
2026
- request = build_jobs_remove_bulk_jobs_request(
2503
+ _request = build_jobs_remove_bulk_jobs_request(
2027
2504
  job_ids=job_ids,
2028
2505
  headers=_headers,
2029
2506
  params=_params,
2030
2507
  )
2031
- request.url = self._client.format_url(request.url)
2508
+ _request.url = self._client.format_url(_request.url)
2032
2509
 
2033
2510
  _stream = False
2034
2511
  pipeline_response: PipelineResponse = (
2035
2512
  self._client._pipeline.run( # pylint: disable=protected-access
2036
- request, stream=_stream, **kwargs
2513
+ _request, stream=_stream, **kwargs
2037
2514
  )
2038
2515
  )
2039
2516
 
2040
2517
  response = pipeline_response.http_response
2041
2518
 
2042
2519
  if response.status_code not in [200]:
2520
+ if _stream:
2521
+ response.read() # Load the body in memory and close the socket
2043
2522
  map_error(
2044
2523
  status_code=response.status_code, response=response, error_map=error_map
2045
2524
  )
@@ -2048,9 +2527,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2048
2527
  deserialized = self._deserialize("object", pipeline_response)
2049
2528
 
2050
2529
  if cls:
2051
- return cls(pipeline_response, deserialized, {})
2530
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2052
2531
 
2053
- return deserialized
2532
+ return deserialized # type: ignore
2054
2533
 
2055
2534
  @distributed_trace
2056
2535
  def get_job_status_bulk(
@@ -2066,7 +2545,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2066
2545
  :rtype: dict[str, ~client.models.LimitedJobStatusReturn]
2067
2546
  :raises ~azure.core.exceptions.HttpResponseError:
2068
2547
  """
2069
- error_map = {
2548
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2070
2549
  401: ClientAuthenticationError,
2071
2550
  404: ResourceNotFoundError,
2072
2551
  409: ResourceExistsError,
@@ -2081,23 +2560,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2081
2560
  "cls", None
2082
2561
  )
2083
2562
 
2084
- request = build_jobs_get_job_status_bulk_request(
2563
+ _request = build_jobs_get_job_status_bulk_request(
2085
2564
  job_ids=job_ids,
2086
2565
  headers=_headers,
2087
2566
  params=_params,
2088
2567
  )
2089
- request.url = self._client.format_url(request.url)
2568
+ _request.url = self._client.format_url(_request.url)
2090
2569
 
2091
2570
  _stream = False
2092
2571
  pipeline_response: PipelineResponse = (
2093
2572
  self._client._pipeline.run( # pylint: disable=protected-access
2094
- request, stream=_stream, **kwargs
2573
+ _request, stream=_stream, **kwargs
2095
2574
  )
2096
2575
  )
2097
2576
 
2098
2577
  response = pipeline_response.http_response
2099
2578
 
2100
2579
  if response.status_code not in [200]:
2580
+ if _stream:
2581
+ response.read() # Load the body in memory and close the socket
2101
2582
  map_error(
2102
2583
  status_code=response.status_code, response=response, error_map=error_map
2103
2584
  )
@@ -2106,9 +2587,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2106
2587
  deserialized = self._deserialize("{LimitedJobStatusReturn}", pipeline_response)
2107
2588
 
2108
2589
  if cls:
2109
- return cls(pipeline_response, deserialized, {})
2590
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2110
2591
 
2111
- return deserialized
2592
+ return deserialized # type: ignore
2112
2593
 
2113
2594
  @overload
2114
2595
  def set_job_status_bulk(
@@ -2138,7 +2619,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2138
2619
  @overload
2139
2620
  def set_job_status_bulk(
2140
2621
  self,
2141
- body: IO,
2622
+ body: IO[bytes],
2142
2623
  *,
2143
2624
  force: bool = False,
2144
2625
  content_type: str = "application/json",
@@ -2149,7 +2630,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2149
2630
  Set Job Status Bulk.
2150
2631
 
2151
2632
  :param body: Required.
2152
- :type body: IO
2633
+ :type body: IO[bytes]
2153
2634
  :keyword force: Default value is False.
2154
2635
  :paramtype force: bool
2155
2636
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -2163,7 +2644,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2163
2644
  @distributed_trace
2164
2645
  def set_job_status_bulk(
2165
2646
  self,
2166
- body: Union[Dict[str, Dict[str, _models.JobStatusUpdate]], IO],
2647
+ body: Union[Dict[str, Dict[str, _models.JobStatusUpdate]], IO[bytes]],
2167
2648
  *,
2168
2649
  force: bool = False,
2169
2650
  **kwargs: Any,
@@ -2172,18 +2653,15 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2172
2653
 
2173
2654
  Set Job Status Bulk.
2174
2655
 
2175
- :param body: Is either a {str: {str: JobStatusUpdate}} type or a IO type. Required.
2176
- :type body: dict[str, dict[str, ~client.models.JobStatusUpdate]] or IO
2656
+ :param body: Is either a {str: {str: JobStatusUpdate}} type or a IO[bytes] type. Required.
2657
+ :type body: dict[str, dict[str, ~client.models.JobStatusUpdate]] or IO[bytes]
2177
2658
  :keyword force: Default value is False.
2178
2659
  :paramtype force: bool
2179
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
2180
- Default value is None.
2181
- :paramtype content_type: str
2182
2660
  :return: dict mapping str to SetJobStatusReturn
2183
2661
  :rtype: dict[str, ~client.models.SetJobStatusReturn]
2184
2662
  :raises ~azure.core.exceptions.HttpResponseError:
2185
2663
  """
2186
- error_map = {
2664
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2187
2665
  401: ClientAuthenticationError,
2188
2666
  404: ResourceNotFoundError,
2189
2667
  409: ResourceExistsError,
@@ -2207,7 +2685,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2207
2685
  else:
2208
2686
  _json = self._serialize.body(body, "{{JobStatusUpdate}}")
2209
2687
 
2210
- request = build_jobs_set_job_status_bulk_request(
2688
+ _request = build_jobs_set_job_status_bulk_request(
2211
2689
  force=force,
2212
2690
  content_type=content_type,
2213
2691
  json=_json,
@@ -2215,18 +2693,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2215
2693
  headers=_headers,
2216
2694
  params=_params,
2217
2695
  )
2218
- request.url = self._client.format_url(request.url)
2696
+ _request.url = self._client.format_url(_request.url)
2219
2697
 
2220
2698
  _stream = False
2221
2699
  pipeline_response: PipelineResponse = (
2222
2700
  self._client._pipeline.run( # pylint: disable=protected-access
2223
- request, stream=_stream, **kwargs
2701
+ _request, stream=_stream, **kwargs
2224
2702
  )
2225
2703
  )
2226
2704
 
2227
2705
  response = pipeline_response.http_response
2228
2706
 
2229
2707
  if response.status_code not in [200]:
2708
+ if _stream:
2709
+ response.read() # Load the body in memory and close the socket
2230
2710
  map_error(
2231
2711
  status_code=response.status_code, response=response, error_map=error_map
2232
2712
  )
@@ -2235,9 +2715,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2235
2715
  deserialized = self._deserialize("{SetJobStatusReturn}", pipeline_response)
2236
2716
 
2237
2717
  if cls:
2238
- return cls(pipeline_response, deserialized, {})
2718
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2239
2719
 
2240
- return deserialized
2720
+ return deserialized # type: ignore
2241
2721
 
2242
2722
  @distributed_trace
2243
2723
  def get_job_status_history_bulk(
@@ -2253,7 +2733,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2253
2733
  :rtype: dict[str, list[~client.models.JobStatusReturn]]
2254
2734
  :raises ~azure.core.exceptions.HttpResponseError:
2255
2735
  """
2256
- error_map = {
2736
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2257
2737
  401: ClientAuthenticationError,
2258
2738
  404: ResourceNotFoundError,
2259
2739
  409: ResourceExistsError,
@@ -2266,23 +2746,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2266
2746
 
2267
2747
  cls: ClsType[Dict[str, List[_models.JobStatusReturn]]] = kwargs.pop("cls", None)
2268
2748
 
2269
- request = build_jobs_get_job_status_history_bulk_request(
2749
+ _request = build_jobs_get_job_status_history_bulk_request(
2270
2750
  job_ids=job_ids,
2271
2751
  headers=_headers,
2272
2752
  params=_params,
2273
2753
  )
2274
- request.url = self._client.format_url(request.url)
2754
+ _request.url = self._client.format_url(_request.url)
2275
2755
 
2276
2756
  _stream = False
2277
2757
  pipeline_response: PipelineResponse = (
2278
2758
  self._client._pipeline.run( # pylint: disable=protected-access
2279
- request, stream=_stream, **kwargs
2759
+ _request, stream=_stream, **kwargs
2280
2760
  )
2281
2761
  )
2282
2762
 
2283
2763
  response = pipeline_response.http_response
2284
2764
 
2285
2765
  if response.status_code not in [200]:
2766
+ if _stream:
2767
+ response.read() # Load the body in memory and close the socket
2286
2768
  map_error(
2287
2769
  status_code=response.status_code, response=response, error_map=error_map
2288
2770
  )
@@ -2291,9 +2773,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2291
2773
  deserialized = self._deserialize("{[JobStatusReturn]}", pipeline_response)
2292
2774
 
2293
2775
  if cls:
2294
- return cls(pipeline_response, deserialized, {})
2776
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2295
2777
 
2296
- return deserialized
2778
+ return deserialized # type: ignore
2297
2779
 
2298
2780
  @distributed_trace
2299
2781
  def reschedule_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
@@ -2307,7 +2789,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2307
2789
  :rtype: any
2308
2790
  :raises ~azure.core.exceptions.HttpResponseError:
2309
2791
  """
2310
- error_map = {
2792
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2311
2793
  401: ClientAuthenticationError,
2312
2794
  404: ResourceNotFoundError,
2313
2795
  409: ResourceExistsError,
@@ -2320,23 +2802,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2320
2802
 
2321
2803
  cls: ClsType[Any] = kwargs.pop("cls", None)
2322
2804
 
2323
- request = build_jobs_reschedule_bulk_jobs_request(
2805
+ _request = build_jobs_reschedule_bulk_jobs_request(
2324
2806
  job_ids=job_ids,
2325
2807
  headers=_headers,
2326
2808
  params=_params,
2327
2809
  )
2328
- request.url = self._client.format_url(request.url)
2810
+ _request.url = self._client.format_url(_request.url)
2329
2811
 
2330
2812
  _stream = False
2331
2813
  pipeline_response: PipelineResponse = (
2332
2814
  self._client._pipeline.run( # pylint: disable=protected-access
2333
- request, stream=_stream, **kwargs
2815
+ _request, stream=_stream, **kwargs
2334
2816
  )
2335
2817
  )
2336
2818
 
2337
2819
  response = pipeline_response.http_response
2338
2820
 
2339
2821
  if response.status_code not in [200]:
2822
+ if _stream:
2823
+ response.read() # Load the body in memory and close the socket
2340
2824
  map_error(
2341
2825
  status_code=response.status_code, response=response, error_map=error_map
2342
2826
  )
@@ -2345,9 +2829,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2345
2829
  deserialized = self._deserialize("object", pipeline_response)
2346
2830
 
2347
2831
  if cls:
2348
- return cls(pipeline_response, deserialized, {})
2832
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2349
2833
 
2350
- return deserialized
2834
+ return deserialized # type: ignore
2351
2835
 
2352
2836
  @distributed_trace
2353
2837
  def reschedule_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2361,7 +2845,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2361
2845
  :rtype: any
2362
2846
  :raises ~azure.core.exceptions.HttpResponseError:
2363
2847
  """
2364
- error_map = {
2848
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2365
2849
  401: ClientAuthenticationError,
2366
2850
  404: ResourceNotFoundError,
2367
2851
  409: ResourceExistsError,
@@ -2374,23 +2858,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2374
2858
 
2375
2859
  cls: ClsType[Any] = kwargs.pop("cls", None)
2376
2860
 
2377
- request = build_jobs_reschedule_single_job_request(
2861
+ _request = build_jobs_reschedule_single_job_request(
2378
2862
  job_id=job_id,
2379
2863
  headers=_headers,
2380
2864
  params=_params,
2381
2865
  )
2382
- request.url = self._client.format_url(request.url)
2866
+ _request.url = self._client.format_url(_request.url)
2383
2867
 
2384
2868
  _stream = False
2385
2869
  pipeline_response: PipelineResponse = (
2386
2870
  self._client._pipeline.run( # pylint: disable=protected-access
2387
- request, stream=_stream, **kwargs
2871
+ _request, stream=_stream, **kwargs
2388
2872
  )
2389
2873
  )
2390
2874
 
2391
2875
  response = pipeline_response.http_response
2392
2876
 
2393
2877
  if response.status_code not in [200]:
2878
+ if _stream:
2879
+ response.read() # Load the body in memory and close the socket
2394
2880
  map_error(
2395
2881
  status_code=response.status_code, response=response, error_map=error_map
2396
2882
  )
@@ -2399,9 +2885,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2399
2885
  deserialized = self._deserialize("object", pipeline_response)
2400
2886
 
2401
2887
  if cls:
2402
- return cls(pipeline_response, deserialized, {})
2888
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2403
2889
 
2404
- return deserialized
2890
+ return deserialized # type: ignore
2405
2891
 
2406
2892
  @overload
2407
2893
  def search(
@@ -2436,7 +2922,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2436
2922
  @overload
2437
2923
  def search(
2438
2924
  self,
2439
- body: Optional[IO] = None,
2925
+ body: Optional[IO[bytes]] = None,
2440
2926
  *,
2441
2927
  page: int = 0,
2442
2928
  per_page: int = 100,
@@ -2450,7 +2936,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2450
2936
  **TODO: Add more docs**.
2451
2937
 
2452
2938
  :param body: Default value is None.
2453
- :type body: IO
2939
+ :type body: IO[bytes]
2454
2940
  :keyword page: Default value is 0.
2455
2941
  :paramtype page: int
2456
2942
  :keyword per_page: Default value is 100.
@@ -2466,7 +2952,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2466
2952
  @distributed_trace
2467
2953
  def search(
2468
2954
  self,
2469
- body: Optional[Union[_models.JobSearchParams, IO]] = None,
2955
+ body: Optional[Union[_models.JobSearchParams, IO[bytes]]] = None,
2470
2956
  *,
2471
2957
  page: int = 0,
2472
2958
  per_page: int = 100,
@@ -2478,20 +2964,17 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2478
2964
 
2479
2965
  **TODO: Add more docs**.
2480
2966
 
2481
- :param body: Is either a JobSearchParams type or a IO type. Default value is None.
2482
- :type body: ~client.models.JobSearchParams or IO
2967
+ :param body: Is either a JobSearchParams type or a IO[bytes] type. Default value is None.
2968
+ :type body: ~client.models.JobSearchParams or IO[bytes]
2483
2969
  :keyword page: Default value is 0.
2484
2970
  :paramtype page: int
2485
2971
  :keyword per_page: Default value is 100.
2486
2972
  :paramtype per_page: int
2487
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
2488
- Default value is None.
2489
- :paramtype content_type: str
2490
2973
  :return: list of JSON
2491
2974
  :rtype: list[JSON]
2492
2975
  :raises ~azure.core.exceptions.HttpResponseError:
2493
2976
  """
2494
- error_map = {
2977
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2495
2978
  401: ClientAuthenticationError,
2496
2979
  404: ResourceNotFoundError,
2497
2980
  409: ResourceExistsError,
@@ -2518,7 +3001,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2518
3001
  else:
2519
3002
  _json = None
2520
3003
 
2521
- request = build_jobs_search_request(
3004
+ _request = build_jobs_search_request(
2522
3005
  page=page,
2523
3006
  per_page=per_page,
2524
3007
  content_type=content_type,
@@ -2527,18 +3010,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2527
3010
  headers=_headers,
2528
3011
  params=_params,
2529
3012
  )
2530
- request.url = self._client.format_url(request.url)
3013
+ _request.url = self._client.format_url(_request.url)
2531
3014
 
2532
3015
  _stream = False
2533
3016
  pipeline_response: PipelineResponse = (
2534
3017
  self._client._pipeline.run( # pylint: disable=protected-access
2535
- request, stream=_stream, **kwargs
3018
+ _request, stream=_stream, **kwargs
2536
3019
  )
2537
3020
  )
2538
3021
 
2539
3022
  response = pipeline_response.http_response
2540
3023
 
2541
3024
  if response.status_code not in [200]:
3025
+ if _stream:
3026
+ response.read() # Load the body in memory and close the socket
2542
3027
  map_error(
2543
3028
  status_code=response.status_code, response=response, error_map=error_map
2544
3029
  )
@@ -2547,9 +3032,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2547
3032
  deserialized = self._deserialize("[object]", pipeline_response)
2548
3033
 
2549
3034
  if cls:
2550
- return cls(pipeline_response, deserialized, {})
3035
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2551
3036
 
2552
- return deserialized
3037
+ return deserialized # type: ignore
2553
3038
 
2554
3039
  @overload
2555
3040
  def summary(
@@ -2575,14 +3060,14 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2575
3060
 
2576
3061
  @overload
2577
3062
  def summary(
2578
- self, body: IO, *, content_type: str = "application/json", **kwargs: Any
3063
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
2579
3064
  ) -> Any:
2580
3065
  """Summary.
2581
3066
 
2582
3067
  Show information suitable for plotting.
2583
3068
 
2584
3069
  :param body: Required.
2585
- :type body: IO
3070
+ :type body: IO[bytes]
2586
3071
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
2587
3072
  Default value is "application/json".
2588
3073
  :paramtype content_type: str
@@ -2592,21 +3077,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2592
3077
  """
2593
3078
 
2594
3079
  @distributed_trace
2595
- def summary(self, body: Union[_models.JobSummaryParams, IO], **kwargs: Any) -> Any:
3080
+ def summary(
3081
+ self, body: Union[_models.JobSummaryParams, IO[bytes]], **kwargs: Any
3082
+ ) -> Any:
2596
3083
  """Summary.
2597
3084
 
2598
3085
  Show information suitable for plotting.
2599
3086
 
2600
- :param body: Is either a JobSummaryParams type or a IO type. Required.
2601
- :type body: ~client.models.JobSummaryParams or IO
2602
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
2603
- Default value is None.
2604
- :paramtype content_type: str
3087
+ :param body: Is either a JobSummaryParams type or a IO[bytes] type. Required.
3088
+ :type body: ~client.models.JobSummaryParams or IO[bytes]
2605
3089
  :return: any
2606
3090
  :rtype: any
2607
3091
  :raises ~azure.core.exceptions.HttpResponseError:
2608
3092
  """
2609
- error_map = {
3093
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2610
3094
  401: ClientAuthenticationError,
2611
3095
  404: ResourceNotFoundError,
2612
3096
  409: ResourceExistsError,
@@ -2630,25 +3114,27 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2630
3114
  else:
2631
3115
  _json = self._serialize.body(body, "JobSummaryParams")
2632
3116
 
2633
- request = build_jobs_summary_request(
3117
+ _request = build_jobs_summary_request(
2634
3118
  content_type=content_type,
2635
3119
  json=_json,
2636
3120
  content=_content,
2637
3121
  headers=_headers,
2638
3122
  params=_params,
2639
3123
  )
2640
- request.url = self._client.format_url(request.url)
3124
+ _request.url = self._client.format_url(_request.url)
2641
3125
 
2642
3126
  _stream = False
2643
3127
  pipeline_response: PipelineResponse = (
2644
3128
  self._client._pipeline.run( # pylint: disable=protected-access
2645
- request, stream=_stream, **kwargs
3129
+ _request, stream=_stream, **kwargs
2646
3130
  )
2647
3131
  )
2648
3132
 
2649
3133
  response = pipeline_response.http_response
2650
3134
 
2651
3135
  if response.status_code not in [200]:
3136
+ if _stream:
3137
+ response.read() # Load the body in memory and close the socket
2652
3138
  map_error(
2653
3139
  status_code=response.status_code, response=response, error_map=error_map
2654
3140
  )
@@ -2657,9 +3143,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2657
3143
  deserialized = self._deserialize("object", pipeline_response)
2658
3144
 
2659
3145
  if cls:
2660
- return cls(pipeline_response, deserialized, {})
3146
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2661
3147
 
2662
- return deserialized
3148
+ return deserialized # type: ignore
2663
3149
 
2664
3150
  @distributed_trace
2665
3151
  def get_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2673,7 +3159,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2673
3159
  :rtype: any
2674
3160
  :raises ~azure.core.exceptions.HttpResponseError:
2675
3161
  """
2676
- error_map = {
3162
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2677
3163
  401: ClientAuthenticationError,
2678
3164
  404: ResourceNotFoundError,
2679
3165
  409: ResourceExistsError,
@@ -2686,23 +3172,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2686
3172
 
2687
3173
  cls: ClsType[Any] = kwargs.pop("cls", None)
2688
3174
 
2689
- request = build_jobs_get_single_job_request(
3175
+ _request = build_jobs_get_single_job_request(
2690
3176
  job_id=job_id,
2691
3177
  headers=_headers,
2692
3178
  params=_params,
2693
3179
  )
2694
- request.url = self._client.format_url(request.url)
3180
+ _request.url = self._client.format_url(_request.url)
2695
3181
 
2696
3182
  _stream = False
2697
3183
  pipeline_response: PipelineResponse = (
2698
3184
  self._client._pipeline.run( # pylint: disable=protected-access
2699
- request, stream=_stream, **kwargs
3185
+ _request, stream=_stream, **kwargs
2700
3186
  )
2701
3187
  )
2702
3188
 
2703
3189
  response = pipeline_response.http_response
2704
3190
 
2705
3191
  if response.status_code not in [200]:
3192
+ if _stream:
3193
+ response.read() # Load the body in memory and close the socket
2706
3194
  map_error(
2707
3195
  status_code=response.status_code, response=response, error_map=error_map
2708
3196
  )
@@ -2711,9 +3199,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2711
3199
  deserialized = self._deserialize("object", pipeline_response)
2712
3200
 
2713
3201
  if cls:
2714
- return cls(pipeline_response, deserialized, {})
3202
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2715
3203
 
2716
- return deserialized
3204
+ return deserialized # type: ignore
2717
3205
 
2718
3206
  @distributed_trace
2719
3207
  def delete_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2727,7 +3215,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2727
3215
  :rtype: any
2728
3216
  :raises ~azure.core.exceptions.HttpResponseError:
2729
3217
  """
2730
- error_map = {
3218
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2731
3219
  401: ClientAuthenticationError,
2732
3220
  404: ResourceNotFoundError,
2733
3221
  409: ResourceExistsError,
@@ -2740,23 +3228,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2740
3228
 
2741
3229
  cls: ClsType[Any] = kwargs.pop("cls", None)
2742
3230
 
2743
- request = build_jobs_delete_single_job_request(
3231
+ _request = build_jobs_delete_single_job_request(
2744
3232
  job_id=job_id,
2745
3233
  headers=_headers,
2746
3234
  params=_params,
2747
3235
  )
2748
- request.url = self._client.format_url(request.url)
3236
+ _request.url = self._client.format_url(_request.url)
2749
3237
 
2750
3238
  _stream = False
2751
3239
  pipeline_response: PipelineResponse = (
2752
3240
  self._client._pipeline.run( # pylint: disable=protected-access
2753
- request, stream=_stream, **kwargs
3241
+ _request, stream=_stream, **kwargs
2754
3242
  )
2755
3243
  )
2756
3244
 
2757
3245
  response = pipeline_response.http_response
2758
3246
 
2759
3247
  if response.status_code not in [200]:
3248
+ if _stream:
3249
+ response.read() # Load the body in memory and close the socket
2760
3250
  map_error(
2761
3251
  status_code=response.status_code, response=response, error_map=error_map
2762
3252
  )
@@ -2765,9 +3255,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2765
3255
  deserialized = self._deserialize("object", pipeline_response)
2766
3256
 
2767
3257
  if cls:
2768
- return cls(pipeline_response, deserialized, {})
3258
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2769
3259
 
2770
- return deserialized
3260
+ return deserialized # type: ignore
2771
3261
 
2772
3262
  @distributed_trace
2773
3263
  def set_single_job_properties(
@@ -2787,7 +3277,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2787
3277
  :rtype: any
2788
3278
  :raises ~azure.core.exceptions.HttpResponseError:
2789
3279
  """
2790
- error_map = {
3280
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2791
3281
  401: ClientAuthenticationError,
2792
3282
  404: ResourceNotFoundError,
2793
3283
  409: ResourceExistsError,
@@ -2805,7 +3295,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2805
3295
 
2806
3296
  _json = self._serialize.body(body, "object")
2807
3297
 
2808
- request = build_jobs_set_single_job_properties_request(
3298
+ _request = build_jobs_set_single_job_properties_request(
2809
3299
  job_id=job_id,
2810
3300
  update_timestamp=update_timestamp,
2811
3301
  content_type=content_type,
@@ -2813,18 +3303,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2813
3303
  headers=_headers,
2814
3304
  params=_params,
2815
3305
  )
2816
- request.url = self._client.format_url(request.url)
3306
+ _request.url = self._client.format_url(_request.url)
2817
3307
 
2818
3308
  _stream = False
2819
3309
  pipeline_response: PipelineResponse = (
2820
3310
  self._client._pipeline.run( # pylint: disable=protected-access
2821
- request, stream=_stream, **kwargs
3311
+ _request, stream=_stream, **kwargs
2822
3312
  )
2823
3313
  )
2824
3314
 
2825
3315
  response = pipeline_response.http_response
2826
3316
 
2827
3317
  if response.status_code not in [200]:
3318
+ if _stream:
3319
+ response.read() # Load the body in memory and close the socket
2828
3320
  map_error(
2829
3321
  status_code=response.status_code, response=response, error_map=error_map
2830
3322
  )
@@ -2833,9 +3325,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2833
3325
  deserialized = self._deserialize("object", pipeline_response)
2834
3326
 
2835
3327
  if cls:
2836
- return cls(pipeline_response, deserialized, {})
3328
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2837
3329
 
2838
- return deserialized
3330
+ return deserialized # type: ignore
2839
3331
 
2840
3332
  @distributed_trace
2841
3333
  def kill_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2849,7 +3341,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2849
3341
  :rtype: any
2850
3342
  :raises ~azure.core.exceptions.HttpResponseError:
2851
3343
  """
2852
- error_map = {
3344
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2853
3345
  401: ClientAuthenticationError,
2854
3346
  404: ResourceNotFoundError,
2855
3347
  409: ResourceExistsError,
@@ -2862,23 +3354,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2862
3354
 
2863
3355
  cls: ClsType[Any] = kwargs.pop("cls", None)
2864
3356
 
2865
- request = build_jobs_kill_single_job_request(
3357
+ _request = build_jobs_kill_single_job_request(
2866
3358
  job_id=job_id,
2867
3359
  headers=_headers,
2868
3360
  params=_params,
2869
3361
  )
2870
- request.url = self._client.format_url(request.url)
3362
+ _request.url = self._client.format_url(_request.url)
2871
3363
 
2872
3364
  _stream = False
2873
3365
  pipeline_response: PipelineResponse = (
2874
3366
  self._client._pipeline.run( # pylint: disable=protected-access
2875
- request, stream=_stream, **kwargs
3367
+ _request, stream=_stream, **kwargs
2876
3368
  )
2877
3369
  )
2878
3370
 
2879
3371
  response = pipeline_response.http_response
2880
3372
 
2881
3373
  if response.status_code not in [200]:
3374
+ if _stream:
3375
+ response.read() # Load the body in memory and close the socket
2882
3376
  map_error(
2883
3377
  status_code=response.status_code, response=response, error_map=error_map
2884
3378
  )
@@ -2887,9 +3381,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2887
3381
  deserialized = self._deserialize("object", pipeline_response)
2888
3382
 
2889
3383
  if cls:
2890
- return cls(pipeline_response, deserialized, {})
3384
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2891
3385
 
2892
- return deserialized
3386
+ return deserialized # type: ignore
2893
3387
 
2894
3388
  @distributed_trace
2895
3389
  def remove_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2907,7 +3401,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2907
3401
  :rtype: any
2908
3402
  :raises ~azure.core.exceptions.HttpResponseError:
2909
3403
  """
2910
- error_map = {
3404
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2911
3405
  401: ClientAuthenticationError,
2912
3406
  404: ResourceNotFoundError,
2913
3407
  409: ResourceExistsError,
@@ -2920,23 +3414,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2920
3414
 
2921
3415
  cls: ClsType[Any] = kwargs.pop("cls", None)
2922
3416
 
2923
- request = build_jobs_remove_single_job_request(
3417
+ _request = build_jobs_remove_single_job_request(
2924
3418
  job_id=job_id,
2925
3419
  headers=_headers,
2926
3420
  params=_params,
2927
3421
  )
2928
- request.url = self._client.format_url(request.url)
3422
+ _request.url = self._client.format_url(_request.url)
2929
3423
 
2930
3424
  _stream = False
2931
3425
  pipeline_response: PipelineResponse = (
2932
3426
  self._client._pipeline.run( # pylint: disable=protected-access
2933
- request, stream=_stream, **kwargs
3427
+ _request, stream=_stream, **kwargs
2934
3428
  )
2935
3429
  )
2936
3430
 
2937
3431
  response = pipeline_response.http_response
2938
3432
 
2939
3433
  if response.status_code not in [200]:
3434
+ if _stream:
3435
+ response.read() # Load the body in memory and close the socket
2940
3436
  map_error(
2941
3437
  status_code=response.status_code, response=response, error_map=error_map
2942
3438
  )
@@ -2945,9 +3441,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2945
3441
  deserialized = self._deserialize("object", pipeline_response)
2946
3442
 
2947
3443
  if cls:
2948
- return cls(pipeline_response, deserialized, {})
3444
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2949
3445
 
2950
- return deserialized
3446
+ return deserialized # type: ignore
2951
3447
 
2952
3448
  @distributed_trace
2953
3449
  def get_single_job_status(
@@ -2963,7 +3459,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2963
3459
  :rtype: dict[str, ~client.models.LimitedJobStatusReturn]
2964
3460
  :raises ~azure.core.exceptions.HttpResponseError:
2965
3461
  """
2966
- error_map = {
3462
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2967
3463
  401: ClientAuthenticationError,
2968
3464
  404: ResourceNotFoundError,
2969
3465
  409: ResourceExistsError,
@@ -2978,23 +3474,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2978
3474
  "cls", None
2979
3475
  )
2980
3476
 
2981
- request = build_jobs_get_single_job_status_request(
3477
+ _request = build_jobs_get_single_job_status_request(
2982
3478
  job_id=job_id,
2983
3479
  headers=_headers,
2984
3480
  params=_params,
2985
3481
  )
2986
- request.url = self._client.format_url(request.url)
3482
+ _request.url = self._client.format_url(_request.url)
2987
3483
 
2988
3484
  _stream = False
2989
3485
  pipeline_response: PipelineResponse = (
2990
3486
  self._client._pipeline.run( # pylint: disable=protected-access
2991
- request, stream=_stream, **kwargs
3487
+ _request, stream=_stream, **kwargs
2992
3488
  )
2993
3489
  )
2994
3490
 
2995
3491
  response = pipeline_response.http_response
2996
3492
 
2997
3493
  if response.status_code not in [200]:
3494
+ if _stream:
3495
+ response.read() # Load the body in memory and close the socket
2998
3496
  map_error(
2999
3497
  status_code=response.status_code, response=response, error_map=error_map
3000
3498
  )
@@ -3003,9 +3501,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3003
3501
  deserialized = self._deserialize("{LimitedJobStatusReturn}", pipeline_response)
3004
3502
 
3005
3503
  if cls:
3006
- return cls(pipeline_response, deserialized, {})
3504
+ return cls(pipeline_response, deserialized, {}) # type: ignore
3007
3505
 
3008
- return deserialized
3506
+ return deserialized # type: ignore
3009
3507
 
3010
3508
  @overload
3011
3509
  def set_single_job_status(
@@ -3039,7 +3537,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3039
3537
  def set_single_job_status(
3040
3538
  self,
3041
3539
  job_id: int,
3042
- body: IO,
3540
+ body: IO[bytes],
3043
3541
  *,
3044
3542
  force: bool = False,
3045
3543
  content_type: str = "application/json",
@@ -3052,7 +3550,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3052
3550
  :param job_id: Required.
3053
3551
  :type job_id: int
3054
3552
  :param body: Required.
3055
- :type body: IO
3553
+ :type body: IO[bytes]
3056
3554
  :keyword force: Default value is False.
3057
3555
  :paramtype force: bool
3058
3556
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -3067,7 +3565,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3067
3565
  def set_single_job_status(
3068
3566
  self,
3069
3567
  job_id: int,
3070
- body: Union[Dict[str, _models.JobStatusUpdate], IO],
3568
+ body: Union[Dict[str, _models.JobStatusUpdate], IO[bytes]],
3071
3569
  *,
3072
3570
  force: bool = False,
3073
3571
  **kwargs: Any,
@@ -3078,18 +3576,15 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3078
3576
 
3079
3577
  :param job_id: Required.
3080
3578
  :type job_id: int
3081
- :param body: Is either a {str: JobStatusUpdate} type or a IO type. Required.
3082
- :type body: dict[str, ~client.models.JobStatusUpdate] or IO
3579
+ :param body: Is either a {str: JobStatusUpdate} type or a IO[bytes] type. Required.
3580
+ :type body: dict[str, ~client.models.JobStatusUpdate] or IO[bytes]
3083
3581
  :keyword force: Default value is False.
3084
3582
  :paramtype force: bool
3085
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
3086
- Default value is None.
3087
- :paramtype content_type: str
3088
3583
  :return: dict mapping str to SetJobStatusReturn
3089
3584
  :rtype: dict[str, ~client.models.SetJobStatusReturn]
3090
3585
  :raises ~azure.core.exceptions.HttpResponseError:
3091
3586
  """
3092
- error_map = {
3587
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
3093
3588
  401: ClientAuthenticationError,
3094
3589
  404: ResourceNotFoundError,
3095
3590
  409: ResourceExistsError,
@@ -3113,7 +3608,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3113
3608
  else:
3114
3609
  _json = self._serialize.body(body, "{JobStatusUpdate}")
3115
3610
 
3116
- request = build_jobs_set_single_job_status_request(
3611
+ _request = build_jobs_set_single_job_status_request(
3117
3612
  job_id=job_id,
3118
3613
  force=force,
3119
3614
  content_type=content_type,
@@ -3122,18 +3617,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3122
3617
  headers=_headers,
3123
3618
  params=_params,
3124
3619
  )
3125
- request.url = self._client.format_url(request.url)
3620
+ _request.url = self._client.format_url(_request.url)
3126
3621
 
3127
3622
  _stream = False
3128
3623
  pipeline_response: PipelineResponse = (
3129
3624
  self._client._pipeline.run( # pylint: disable=protected-access
3130
- request, stream=_stream, **kwargs
3625
+ _request, stream=_stream, **kwargs
3131
3626
  )
3132
3627
  )
3133
3628
 
3134
3629
  response = pipeline_response.http_response
3135
3630
 
3136
3631
  if response.status_code not in [200]:
3632
+ if _stream:
3633
+ response.read() # Load the body in memory and close the socket
3137
3634
  map_error(
3138
3635
  status_code=response.status_code, response=response, error_map=error_map
3139
3636
  )
@@ -3142,9 +3639,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3142
3639
  deserialized = self._deserialize("{SetJobStatusReturn}", pipeline_response)
3143
3640
 
3144
3641
  if cls:
3145
- return cls(pipeline_response, deserialized, {})
3642
+ return cls(pipeline_response, deserialized, {}) # type: ignore
3146
3643
 
3147
- return deserialized
3644
+ return deserialized # type: ignore
3148
3645
 
3149
3646
  @distributed_trace
3150
3647
  def get_single_job_status_history(
@@ -3160,7 +3657,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3160
3657
  :rtype: dict[str, list[~client.models.JobStatusReturn]]
3161
3658
  :raises ~azure.core.exceptions.HttpResponseError:
3162
3659
  """
3163
- error_map = {
3660
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
3164
3661
  401: ClientAuthenticationError,
3165
3662
  404: ResourceNotFoundError,
3166
3663
  409: ResourceExistsError,
@@ -3173,23 +3670,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3173
3670
 
3174
3671
  cls: ClsType[Dict[str, List[_models.JobStatusReturn]]] = kwargs.pop("cls", None)
3175
3672
 
3176
- request = build_jobs_get_single_job_status_history_request(
3673
+ _request = build_jobs_get_single_job_status_history_request(
3177
3674
  job_id=job_id,
3178
3675
  headers=_headers,
3179
3676
  params=_params,
3180
3677
  )
3181
- request.url = self._client.format_url(request.url)
3678
+ _request.url = self._client.format_url(_request.url)
3182
3679
 
3183
3680
  _stream = False
3184
3681
  pipeline_response: PipelineResponse = (
3185
3682
  self._client._pipeline.run( # pylint: disable=protected-access
3186
- request, stream=_stream, **kwargs
3683
+ _request, stream=_stream, **kwargs
3187
3684
  )
3188
3685
  )
3189
3686
 
3190
3687
  response = pipeline_response.http_response
3191
3688
 
3192
3689
  if response.status_code not in [200]:
3690
+ if _stream:
3691
+ response.read() # Load the body in memory and close the socket
3193
3692
  map_error(
3194
3693
  status_code=response.status_code, response=response, error_map=error_map
3195
3694
  )
@@ -3198,6 +3697,6 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3198
3697
  deserialized = self._deserialize("{[JobStatusReturn]}", pipeline_response)
3199
3698
 
3200
3699
  if cls:
3201
- return cls(pipeline_response, deserialized, {})
3700
+ return cls(pipeline_response, deserialized, {}) # type: ignore
3202
3701
 
3203
- return deserialized
3702
+ return deserialized # type: ignore