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,24 +1,36 @@
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 AsyncHttpResponse
21
- from azure.core.rest import HttpRequest
33
+ from azure.core.rest import AsyncHttpResponse, HttpRequest
22
34
  from azure.core.tracing.decorator_async import distributed_trace_async
23
35
  from azure.core.utils import case_insensitive_dict
24
36
 
@@ -34,8 +46,11 @@ from ...operations._operations import (
34
46
  build_auth_revoke_refresh_token_request,
35
47
  build_auth_userinfo_request,
36
48
  build_config_serve_config_request,
49
+ build_jobs_assign_sandbox_to_job_request,
37
50
  build_jobs_delete_bulk_jobs_request,
38
51
  build_jobs_delete_single_job_request,
52
+ build_jobs_get_job_sandbox_request,
53
+ build_jobs_get_job_sandboxes_request,
39
54
  build_jobs_get_job_status_bulk_request,
40
55
  build_jobs_get_job_status_history_bulk_request,
41
56
  build_jobs_get_sandbox_file_request,
@@ -55,6 +70,8 @@ from ...operations._operations import (
55
70
  build_jobs_set_single_job_status_request,
56
71
  build_jobs_submit_bulk_jobs_request,
57
72
  build_jobs_summary_request,
73
+ build_jobs_unassign_bulk_jobs_sandboxes_request,
74
+ build_jobs_unassign_job_sandboxes_request,
58
75
  build_well_known_installation_metadata_request,
59
76
  build_well_known_openid_configuration_request,
60
77
  )
@@ -96,13 +113,13 @@ class WellKnownOperations:
96
113
  async def openid_configuration(self, **kwargs: Any) -> Any:
97
114
  """Openid Configuration.
98
115
 
99
- Openid Configuration.
116
+ OpenID Connect discovery endpoint.
100
117
 
101
118
  :return: any
102
119
  :rtype: any
103
120
  :raises ~azure.core.exceptions.HttpResponseError:
104
121
  """
105
- error_map = {
122
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
106
123
  401: ClientAuthenticationError,
107
124
  404: ResourceNotFoundError,
108
125
  409: ResourceExistsError,
@@ -115,22 +132,24 @@ class WellKnownOperations:
115
132
 
116
133
  cls: ClsType[Any] = kwargs.pop("cls", None)
117
134
 
118
- request = build_well_known_openid_configuration_request(
135
+ _request = build_well_known_openid_configuration_request(
119
136
  headers=_headers,
120
137
  params=_params,
121
138
  )
122
- request.url = self._client.format_url(request.url)
139
+ _request.url = self._client.format_url(_request.url)
123
140
 
124
141
  _stream = False
125
142
  pipeline_response: PipelineResponse = (
126
143
  await self._client._pipeline.run( # pylint: disable=protected-access
127
- request, stream=_stream, **kwargs
144
+ _request, stream=_stream, **kwargs
128
145
  )
129
146
  )
130
147
 
131
148
  response = pipeline_response.http_response
132
149
 
133
150
  if response.status_code not in [200]:
151
+ if _stream:
152
+ await response.read() # Load the body in memory and close the socket
134
153
  map_error(
135
154
  status_code=response.status_code, response=response, error_map=error_map
136
155
  )
@@ -139,21 +158,21 @@ class WellKnownOperations:
139
158
  deserialized = self._deserialize("object", pipeline_response)
140
159
 
141
160
  if cls:
142
- return cls(pipeline_response, deserialized, {})
161
+ return cls(pipeline_response, deserialized, {}) # type: ignore
143
162
 
144
- return deserialized
163
+ return deserialized # type: ignore
145
164
 
146
165
  @distributed_trace_async
147
166
  async def installation_metadata(self, **kwargs: Any) -> _models.Metadata:
148
167
  """Installation Metadata.
149
168
 
150
- Installation Metadata.
169
+ Get metadata about the dirac installation.
151
170
 
152
171
  :return: Metadata
153
172
  :rtype: ~client.models.Metadata
154
173
  :raises ~azure.core.exceptions.HttpResponseError:
155
174
  """
156
- error_map = {
175
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
157
176
  401: ClientAuthenticationError,
158
177
  404: ResourceNotFoundError,
159
178
  409: ResourceExistsError,
@@ -166,22 +185,24 @@ class WellKnownOperations:
166
185
 
167
186
  cls: ClsType[_models.Metadata] = kwargs.pop("cls", None)
168
187
 
169
- request = build_well_known_installation_metadata_request(
188
+ _request = build_well_known_installation_metadata_request(
170
189
  headers=_headers,
171
190
  params=_params,
172
191
  )
173
- request.url = self._client.format_url(request.url)
192
+ _request.url = self._client.format_url(_request.url)
174
193
 
175
194
  _stream = False
176
195
  pipeline_response: PipelineResponse = (
177
196
  await self._client._pipeline.run( # pylint: disable=protected-access
178
- request, stream=_stream, **kwargs
197
+ _request, stream=_stream, **kwargs
179
198
  )
180
199
  )
181
200
 
182
201
  response = pipeline_response.http_response
183
202
 
184
203
  if response.status_code not in [200]:
204
+ if _stream:
205
+ await response.read() # Load the body in memory and close the socket
185
206
  map_error(
186
207
  status_code=response.status_code, response=response, error_map=error_map
187
208
  )
@@ -190,12 +211,12 @@ class WellKnownOperations:
190
211
  deserialized = self._deserialize("Metadata", pipeline_response)
191
212
 
192
213
  if cls:
193
- return cls(pipeline_response, deserialized, {})
214
+ return cls(pipeline_response, deserialized, {}) # type: ignore
194
215
 
195
- return deserialized
216
+ return deserialized # type: ignore
196
217
 
197
218
 
198
- class AuthOperations:
219
+ class AuthOperations: # pylint: disable=abstract-class-instantiated
199
220
  """
200
221
  .. warning::
201
222
  **DO NOT** instantiate this class directly.
@@ -215,6 +236,7 @@ class AuthOperations:
215
236
  self._deserialize = (
216
237
  input_args.pop(0) if input_args else kwargs.pop("deserializer")
217
238
  )
239
+
218
240
  raise_if_not_implemented(
219
241
  self.__class__,
220
242
  [
@@ -241,7 +263,7 @@ class AuthOperations:
241
263
  :rtype: any
242
264
  :raises ~azure.core.exceptions.HttpResponseError:
243
265
  """
244
- error_map = {
266
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
245
267
  401: ClientAuthenticationError,
246
268
  404: ResourceNotFoundError,
247
269
  409: ResourceExistsError,
@@ -254,23 +276,25 @@ class AuthOperations:
254
276
 
255
277
  cls: ClsType[Any] = kwargs.pop("cls", None)
256
278
 
257
- request = build_auth_do_device_flow_request(
279
+ _request = build_auth_do_device_flow_request(
258
280
  user_code=user_code,
259
281
  headers=_headers,
260
282
  params=_params,
261
283
  )
262
- request.url = self._client.format_url(request.url)
284
+ _request.url = self._client.format_url(_request.url)
263
285
 
264
286
  _stream = False
265
287
  pipeline_response: PipelineResponse = (
266
288
  await self._client._pipeline.run( # pylint: disable=protected-access
267
- request, stream=_stream, **kwargs
289
+ _request, stream=_stream, **kwargs
268
290
  )
269
291
  )
270
292
 
271
293
  response = pipeline_response.http_response
272
294
 
273
295
  if response.status_code not in [200]:
296
+ if _stream:
297
+ await response.read() # Load the body in memory and close the socket
274
298
  map_error(
275
299
  status_code=response.status_code, response=response, error_map=error_map
276
300
  )
@@ -279,13 +303,13 @@ class AuthOperations:
279
303
  deserialized = self._deserialize("object", pipeline_response)
280
304
 
281
305
  if cls:
282
- return cls(pipeline_response, deserialized, {})
306
+ return cls(pipeline_response, deserialized, {}) # type: ignore
283
307
 
284
- return deserialized
308
+ return deserialized # type: ignore
285
309
 
286
310
  @distributed_trace_async
287
311
  async def initiate_device_flow(
288
- self, *, client_id: str, scope: str, audience: str, **kwargs: Any
312
+ self, *, client_id: str, scope: str, **kwargs: Any
289
313
  ) -> _models.InitiateDeviceFlowResponse:
290
314
  """Initiate Device Flow.
291
315
 
@@ -301,13 +325,11 @@ class AuthOperations:
301
325
  :paramtype client_id: str
302
326
  :keyword scope: Required.
303
327
  :paramtype scope: str
304
- :keyword audience: Required.
305
- :paramtype audience: str
306
328
  :return: InitiateDeviceFlowResponse
307
329
  :rtype: ~client.models.InitiateDeviceFlowResponse
308
330
  :raises ~azure.core.exceptions.HttpResponseError:
309
331
  """
310
- error_map = {
332
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
311
333
  401: ClientAuthenticationError,
312
334
  404: ResourceNotFoundError,
313
335
  409: ResourceExistsError,
@@ -320,25 +342,26 @@ class AuthOperations:
320
342
 
321
343
  cls: ClsType[_models.InitiateDeviceFlowResponse] = kwargs.pop("cls", None)
322
344
 
323
- request = build_auth_initiate_device_flow_request(
345
+ _request = build_auth_initiate_device_flow_request(
324
346
  client_id=client_id,
325
347
  scope=scope,
326
- audience=audience,
327
348
  headers=_headers,
328
349
  params=_params,
329
350
  )
330
- request.url = self._client.format_url(request.url)
351
+ _request.url = self._client.format_url(_request.url)
331
352
 
332
353
  _stream = False
333
354
  pipeline_response: PipelineResponse = (
334
355
  await self._client._pipeline.run( # pylint: disable=protected-access
335
- request, stream=_stream, **kwargs
356
+ _request, stream=_stream, **kwargs
336
357
  )
337
358
  )
338
359
 
339
360
  response = pipeline_response.http_response
340
361
 
341
362
  if response.status_code not in [200]:
363
+ if _stream:
364
+ await response.read() # Load the body in memory and close the socket
342
365
  map_error(
343
366
  status_code=response.status_code, response=response, error_map=error_map
344
367
  )
@@ -349,9 +372,9 @@ class AuthOperations:
349
372
  )
350
373
 
351
374
  if cls:
352
- return cls(pipeline_response, deserialized, {})
375
+ return cls(pipeline_response, deserialized, {}) # type: ignore
353
376
 
354
- return deserialized
377
+ return deserialized # type: ignore
355
378
 
356
379
  @distributed_trace_async
357
380
  async def finish_device_flow(self, *, code: str, state: str, **kwargs: Any) -> Any:
@@ -371,7 +394,7 @@ class AuthOperations:
371
394
  :rtype: any
372
395
  :raises ~azure.core.exceptions.HttpResponseError:
373
396
  """
374
- error_map = {
397
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
375
398
  401: ClientAuthenticationError,
376
399
  404: ResourceNotFoundError,
377
400
  409: ResourceExistsError,
@@ -384,24 +407,26 @@ class AuthOperations:
384
407
 
385
408
  cls: ClsType[Any] = kwargs.pop("cls", None)
386
409
 
387
- request = build_auth_finish_device_flow_request(
410
+ _request = build_auth_finish_device_flow_request(
388
411
  code=code,
389
412
  state=state,
390
413
  headers=_headers,
391
414
  params=_params,
392
415
  )
393
- request.url = self._client.format_url(request.url)
416
+ _request.url = self._client.format_url(_request.url)
394
417
 
395
418
  _stream = False
396
419
  pipeline_response: PipelineResponse = (
397
420
  await self._client._pipeline.run( # pylint: disable=protected-access
398
- request, stream=_stream, **kwargs
421
+ _request, stream=_stream, **kwargs
399
422
  )
400
423
  )
401
424
 
402
425
  response = pipeline_response.http_response
403
426
 
404
427
  if response.status_code not in [200]:
428
+ if _stream:
429
+ await response.read() # Load the body in memory and close the socket
405
430
  map_error(
406
431
  status_code=response.status_code, response=response, error_map=error_map
407
432
  )
@@ -410,21 +435,21 @@ class AuthOperations:
410
435
  deserialized = self._deserialize("object", pipeline_response)
411
436
 
412
437
  if cls:
413
- return cls(pipeline_response, deserialized, {})
438
+ return cls(pipeline_response, deserialized, {}) # type: ignore
414
439
 
415
- return deserialized
440
+ return deserialized # type: ignore
416
441
 
417
442
  @distributed_trace_async
418
443
  async def finished(self, **kwargs: Any) -> Any:
419
444
  """Finished.
420
445
 
421
- Finished.
446
+ This is the final step of the device flow.
422
447
 
423
448
  :return: any
424
449
  :rtype: any
425
450
  :raises ~azure.core.exceptions.HttpResponseError:
426
451
  """
427
- error_map = {
452
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
428
453
  401: ClientAuthenticationError,
429
454
  404: ResourceNotFoundError,
430
455
  409: ResourceExistsError,
@@ -437,22 +462,24 @@ class AuthOperations:
437
462
 
438
463
  cls: ClsType[Any] = kwargs.pop("cls", None)
439
464
 
440
- request = build_auth_finished_request(
465
+ _request = build_auth_finished_request(
441
466
  headers=_headers,
442
467
  params=_params,
443
468
  )
444
- request.url = self._client.format_url(request.url)
469
+ _request.url = self._client.format_url(_request.url)
445
470
 
446
471
  _stream = False
447
472
  pipeline_response: PipelineResponse = (
448
473
  await self._client._pipeline.run( # pylint: disable=protected-access
449
- request, stream=_stream, **kwargs
474
+ _request, stream=_stream, **kwargs
450
475
  )
451
476
  )
452
477
 
453
478
  response = pipeline_response.http_response
454
479
 
455
480
  if response.status_code not in [200]:
481
+ if _stream:
482
+ await response.read() # Load the body in memory and close the socket
456
483
  map_error(
457
484
  status_code=response.status_code, response=response, error_map=error_map
458
485
  )
@@ -461,21 +488,22 @@ class AuthOperations:
461
488
  deserialized = self._deserialize("object", pipeline_response)
462
489
 
463
490
  if cls:
464
- return cls(pipeline_response, deserialized, {})
491
+ return cls(pipeline_response, deserialized, {}) # type: ignore
465
492
 
466
- return deserialized
493
+ return deserialized # type: ignore
467
494
 
468
495
  @distributed_trace_async
469
496
  async def get_refresh_tokens(self, **kwargs: Any) -> List[Any]:
470
497
  """Get Refresh Tokens.
471
498
 
472
- Get Refresh Tokens.
499
+ Get all refresh tokens for the user. If the user has the ``proxy_management`` property, then
500
+ the subject is not used to filter the refresh tokens.
473
501
 
474
502
  :return: list of any
475
503
  :rtype: list[any]
476
504
  :raises ~azure.core.exceptions.HttpResponseError:
477
505
  """
478
- error_map = {
506
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
479
507
  401: ClientAuthenticationError,
480
508
  404: ResourceNotFoundError,
481
509
  409: ResourceExistsError,
@@ -488,22 +516,24 @@ class AuthOperations:
488
516
 
489
517
  cls: ClsType[List[Any]] = kwargs.pop("cls", None)
490
518
 
491
- request = build_auth_get_refresh_tokens_request(
519
+ _request = build_auth_get_refresh_tokens_request(
492
520
  headers=_headers,
493
521
  params=_params,
494
522
  )
495
- request.url = self._client.format_url(request.url)
523
+ _request.url = self._client.format_url(_request.url)
496
524
 
497
525
  _stream = False
498
526
  pipeline_response: PipelineResponse = (
499
527
  await self._client._pipeline.run( # pylint: disable=protected-access
500
- request, stream=_stream, **kwargs
528
+ _request, stream=_stream, **kwargs
501
529
  )
502
530
  )
503
531
 
504
532
  response = pipeline_response.http_response
505
533
 
506
534
  if response.status_code not in [200]:
535
+ if _stream:
536
+ await response.read() # Load the body in memory and close the socket
507
537
  map_error(
508
538
  status_code=response.status_code, response=response, error_map=error_map
509
539
  )
@@ -512,15 +542,16 @@ class AuthOperations:
512
542
  deserialized = self._deserialize("[object]", pipeline_response)
513
543
 
514
544
  if cls:
515
- return cls(pipeline_response, deserialized, {})
545
+ return cls(pipeline_response, deserialized, {}) # type: ignore
516
546
 
517
- return deserialized
547
+ return deserialized # type: ignore
518
548
 
519
549
  @distributed_trace_async
520
550
  async def revoke_refresh_token(self, jti: str, **kwargs: Any) -> str:
521
551
  """Revoke Refresh Token.
522
552
 
523
- Revoke Refresh Token.
553
+ Revoke a refresh token. If the user has the ``proxy_management`` property, then
554
+ the subject is not used to filter the refresh tokens.
524
555
 
525
556
  :param jti: Required.
526
557
  :type jti: str
@@ -528,7 +559,7 @@ class AuthOperations:
528
559
  :rtype: str
529
560
  :raises ~azure.core.exceptions.HttpResponseError:
530
561
  """
531
- error_map = {
562
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
532
563
  401: ClientAuthenticationError,
533
564
  404: ResourceNotFoundError,
534
565
  409: ResourceExistsError,
@@ -541,23 +572,25 @@ class AuthOperations:
541
572
 
542
573
  cls: ClsType[str] = kwargs.pop("cls", None)
543
574
 
544
- request = build_auth_revoke_refresh_token_request(
575
+ _request = build_auth_revoke_refresh_token_request(
545
576
  jti=jti,
546
577
  headers=_headers,
547
578
  params=_params,
548
579
  )
549
- request.url = self._client.format_url(request.url)
580
+ _request.url = self._client.format_url(_request.url)
550
581
 
551
582
  _stream = False
552
583
  pipeline_response: PipelineResponse = (
553
584
  await self._client._pipeline.run( # pylint: disable=protected-access
554
- request, stream=_stream, **kwargs
585
+ _request, stream=_stream, **kwargs
555
586
  )
556
587
  )
557
588
 
558
589
  response = pipeline_response.http_response
559
590
 
560
591
  if response.status_code not in [200]:
592
+ if _stream:
593
+ await response.read() # Load the body in memory and close the socket
561
594
  map_error(
562
595
  status_code=response.status_code, response=response, error_map=error_map
563
596
  )
@@ -566,17 +599,70 @@ class AuthOperations:
566
599
  deserialized = self._deserialize("str", pipeline_response)
567
600
 
568
601
  if cls:
569
- return cls(pipeline_response, deserialized, {})
602
+ return cls(pipeline_response, deserialized, {}) # type: ignore
603
+
604
+ return deserialized # type: ignore
605
+
606
+ @distributed_trace_async
607
+ async def userinfo(self, **kwargs: Any) -> _models.UserInfoResponse:
608
+ """Userinfo.
609
+
610
+ Get information about the user's identity.
611
+
612
+ :return: UserInfoResponse
613
+ :rtype: ~client.models.UserInfoResponse
614
+ :raises ~azure.core.exceptions.HttpResponseError:
615
+ """
616
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
617
+ 401: ClientAuthenticationError,
618
+ 404: ResourceNotFoundError,
619
+ 409: ResourceExistsError,
620
+ 304: ResourceNotModifiedError,
621
+ }
622
+ error_map.update(kwargs.pop("error_map", {}) or {})
623
+
624
+ _headers = kwargs.pop("headers", {}) or {}
625
+ _params = kwargs.pop("params", {}) or {}
626
+
627
+ cls: ClsType[_models.UserInfoResponse] = kwargs.pop("cls", None)
628
+
629
+ _request = build_auth_userinfo_request(
630
+ headers=_headers,
631
+ params=_params,
632
+ )
633
+ _request.url = self._client.format_url(_request.url)
634
+
635
+ _stream = False
636
+ pipeline_response: PipelineResponse = (
637
+ await self._client._pipeline.run( # pylint: disable=protected-access
638
+ _request, stream=_stream, **kwargs
639
+ )
640
+ )
641
+
642
+ response = pipeline_response.http_response
643
+
644
+ if response.status_code not in [200]:
645
+ if _stream:
646
+ await response.read() # Load the body in memory and close the socket
647
+ map_error(
648
+ status_code=response.status_code, response=response, error_map=error_map
649
+ )
650
+ raise HttpResponseError(response=response)
651
+
652
+ deserialized = self._deserialize("UserInfoResponse", pipeline_response)
653
+
654
+ if cls:
655
+ return cls(pipeline_response, deserialized, {}) # type: ignore
570
656
 
571
- return deserialized
657
+ return deserialized # type: ignore
572
658
 
573
659
  @distributed_trace_async
574
660
  async def authorization_flow(
575
661
  self,
576
662
  *,
577
- response_type: Union[str, _models.Enum3],
663
+ response_type: Union[str, _models.Enum0],
578
664
  code_challenge: str,
579
- code_challenge_method: Union[str, _models.Enum4],
665
+ code_challenge_method: Union[str, _models.Enum1],
580
666
  client_id: str,
581
667
  redirect_uri: str,
582
668
  scope: str,
@@ -585,14 +671,20 @@ class AuthOperations:
585
671
  ) -> Any:
586
672
  """Authorization Flow.
587
673
 
588
- Authorization Flow.
674
+ Initiate the authorization flow.
675
+ It will redirect to the actual OpenID server (IAM, CheckIn) to
676
+ perform a authorization code flow.
677
+
678
+ We set the user details obtained from the user authorize flow in a cookie
679
+ to be able to map the authorization flow with the corresponding
680
+ user authorize flow.
589
681
 
590
682
  :keyword response_type: "code" Required.
591
- :paramtype response_type: str or ~client.models.Enum3
683
+ :paramtype response_type: str or ~client.models.Enum0
592
684
  :keyword code_challenge: Required.
593
685
  :paramtype code_challenge: str
594
686
  :keyword code_challenge_method: "S256" Required.
595
- :paramtype code_challenge_method: str or ~client.models.Enum4
687
+ :paramtype code_challenge_method: str or ~client.models.Enum1
596
688
  :keyword client_id: Required.
597
689
  :paramtype client_id: str
598
690
  :keyword redirect_uri: Required.
@@ -605,7 +697,7 @@ class AuthOperations:
605
697
  :rtype: any
606
698
  :raises ~azure.core.exceptions.HttpResponseError:
607
699
  """
608
- error_map = {
700
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
609
701
  401: ClientAuthenticationError,
610
702
  404: ResourceNotFoundError,
611
703
  409: ResourceExistsError,
@@ -618,7 +710,7 @@ class AuthOperations:
618
710
 
619
711
  cls: ClsType[Any] = kwargs.pop("cls", None)
620
712
 
621
- request = build_auth_authorization_flow_request(
713
+ _request = build_auth_authorization_flow_request(
622
714
  response_type=response_type,
623
715
  code_challenge=code_challenge,
624
716
  code_challenge_method=code_challenge_method,
@@ -629,18 +721,20 @@ class AuthOperations:
629
721
  headers=_headers,
630
722
  params=_params,
631
723
  )
632
- request.url = self._client.format_url(request.url)
724
+ _request.url = self._client.format_url(_request.url)
633
725
 
634
726
  _stream = False
635
727
  pipeline_response: PipelineResponse = (
636
728
  await self._client._pipeline.run( # pylint: disable=protected-access
637
- request, stream=_stream, **kwargs
729
+ _request, stream=_stream, **kwargs
638
730
  )
639
731
  )
640
732
 
641
733
  response = pipeline_response.http_response
642
734
 
643
735
  if response.status_code not in [200]:
736
+ if _stream:
737
+ await response.read() # Load the body in memory and close the socket
644
738
  map_error(
645
739
  status_code=response.status_code, response=response, error_map=error_map
646
740
  )
@@ -649,9 +743,9 @@ class AuthOperations:
649
743
  deserialized = self._deserialize("object", pipeline_response)
650
744
 
651
745
  if cls:
652
- return cls(pipeline_response, deserialized, {})
746
+ return cls(pipeline_response, deserialized, {}) # type: ignore
653
747
 
654
- return deserialized
748
+ return deserialized # type: ignore
655
749
 
656
750
  @distributed_trace_async
657
751
  async def authorization_flow_complete(
@@ -659,7 +753,13 @@ class AuthOperations:
659
753
  ) -> Any:
660
754
  """Authorization Flow Complete.
661
755
 
662
- Authorization Flow Complete.
756
+ Complete the authorization flow.
757
+
758
+ The user is redirected back to the DIRAC auth service after completing the IAM's authorization
759
+ flow.
760
+ We retrieve the original flow details from the decrypted state and store the ID token requested
761
+ from the IAM.
762
+ The user is then redirected to the client's redirect URI.
663
763
 
664
764
  :keyword code: Required.
665
765
  :paramtype code: str
@@ -669,7 +769,7 @@ class AuthOperations:
669
769
  :rtype: any
670
770
  :raises ~azure.core.exceptions.HttpResponseError:
671
771
  """
672
- error_map = {
772
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
673
773
  401: ClientAuthenticationError,
674
774
  404: ResourceNotFoundError,
675
775
  409: ResourceExistsError,
@@ -682,24 +782,26 @@ class AuthOperations:
682
782
 
683
783
  cls: ClsType[Any] = kwargs.pop("cls", None)
684
784
 
685
- request = build_auth_authorization_flow_complete_request(
785
+ _request = build_auth_authorization_flow_complete_request(
686
786
  code=code,
687
787
  state=state,
688
788
  headers=_headers,
689
789
  params=_params,
690
790
  )
691
- request.url = self._client.format_url(request.url)
791
+ _request.url = self._client.format_url(_request.url)
692
792
 
693
793
  _stream = False
694
794
  pipeline_response: PipelineResponse = (
695
795
  await self._client._pipeline.run( # pylint: disable=protected-access
696
- request, stream=_stream, **kwargs
796
+ _request, stream=_stream, **kwargs
697
797
  )
698
798
  )
699
799
 
700
800
  response = pipeline_response.http_response
701
801
 
702
802
  if response.status_code not in [200]:
803
+ if _stream:
804
+ await response.read() # Load the body in memory and close the socket
703
805
  map_error(
704
806
  status_code=response.status_code, response=response, error_map=error_map
705
807
  )
@@ -708,60 +810,9 @@ class AuthOperations:
708
810
  deserialized = self._deserialize("object", pipeline_response)
709
811
 
710
812
  if cls:
711
- return cls(pipeline_response, deserialized, {})
712
-
713
- return deserialized
714
-
715
- @distributed_trace_async
716
- async def userinfo(self, **kwargs: Any) -> _models.UserInfoResponse:
717
- """Userinfo.
718
-
719
- Userinfo.
720
-
721
- :return: UserInfoResponse
722
- :rtype: ~client.models.UserInfoResponse
723
- :raises ~azure.core.exceptions.HttpResponseError:
724
- """
725
- error_map = {
726
- 401: ClientAuthenticationError,
727
- 404: ResourceNotFoundError,
728
- 409: ResourceExistsError,
729
- 304: ResourceNotModifiedError,
730
- }
731
- error_map.update(kwargs.pop("error_map", {}) or {})
732
-
733
- _headers = kwargs.pop("headers", {}) or {}
734
- _params = kwargs.pop("params", {}) or {}
735
-
736
- cls: ClsType[_models.UserInfoResponse] = kwargs.pop("cls", None)
737
-
738
- request = build_auth_userinfo_request(
739
- headers=_headers,
740
- params=_params,
741
- )
742
- request.url = self._client.format_url(request.url)
743
-
744
- _stream = False
745
- pipeline_response: PipelineResponse = (
746
- await self._client._pipeline.run( # pylint: disable=protected-access
747
- request, stream=_stream, **kwargs
748
- )
749
- )
750
-
751
- response = pipeline_response.http_response
752
-
753
- if response.status_code not in [200]:
754
- map_error(
755
- status_code=response.status_code, response=response, error_map=error_map
756
- )
757
- raise HttpResponseError(response=response)
758
-
759
- deserialized = self._deserialize("UserInfoResponse", pipeline_response)
760
-
761
- if cls:
762
- return cls(pipeline_response, deserialized, {})
813
+ return cls(pipeline_response, deserialized, {}) # type: ignore
763
814
 
764
- return deserialized
815
+ return deserialized # type: ignore
765
816
 
766
817
 
767
818
  class ConfigOperations:
@@ -789,8 +840,9 @@ class ConfigOperations:
789
840
  async def serve_config(
790
841
  self,
791
842
  *,
792
- if_none_match: Optional[str] = None,
793
843
  if_modified_since: Optional[str] = None,
844
+ etag: Optional[str] = None,
845
+ match_condition: Optional[MatchConditions] = None,
794
846
  **kwargs: Any,
795
847
  ) -> Any:
796
848
  """Serve Config.
@@ -802,20 +854,29 @@ class ConfigOperations:
802
854
  If If-Modified-Since is given and is newer than latest,
803
855
  return 304: this is to avoid flip/flopping.
804
856
 
805
- :keyword if_none_match: Default value is None.
806
- :paramtype if_none_match: str
807
857
  :keyword if_modified_since: Default value is None.
808
858
  :paramtype if_modified_since: str
859
+ :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is
860
+ None.
861
+ :paramtype etag: str
862
+ :keyword match_condition: The match condition to use upon the etag. Default value is None.
863
+ :paramtype match_condition: ~azure.core.MatchConditions
809
864
  :return: any
810
865
  :rtype: any
811
866
  :raises ~azure.core.exceptions.HttpResponseError:
812
867
  """
813
- error_map = {
868
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
814
869
  401: ClientAuthenticationError,
815
870
  404: ResourceNotFoundError,
816
871
  409: ResourceExistsError,
817
872
  304: ResourceNotModifiedError,
818
873
  }
874
+ if match_condition == MatchConditions.IfNotModified:
875
+ error_map[412] = ResourceModifiedError
876
+ elif match_condition == MatchConditions.IfPresent:
877
+ error_map[412] = ResourceNotFoundError
878
+ elif match_condition == MatchConditions.IfMissing:
879
+ error_map[412] = ResourceExistsError
819
880
  error_map.update(kwargs.pop("error_map", {}) or {})
820
881
 
821
882
  _headers = kwargs.pop("headers", {}) or {}
@@ -823,24 +884,27 @@ class ConfigOperations:
823
884
 
824
885
  cls: ClsType[Any] = kwargs.pop("cls", None)
825
886
 
826
- request = build_config_serve_config_request(
827
- if_none_match=if_none_match,
887
+ _request = build_config_serve_config_request(
828
888
  if_modified_since=if_modified_since,
889
+ etag=etag,
890
+ match_condition=match_condition,
829
891
  headers=_headers,
830
892
  params=_params,
831
893
  )
832
- request.url = self._client.format_url(request.url)
894
+ _request.url = self._client.format_url(_request.url)
833
895
 
834
896
  _stream = False
835
897
  pipeline_response: PipelineResponse = (
836
898
  await self._client._pipeline.run( # pylint: disable=protected-access
837
- request, stream=_stream, **kwargs
899
+ _request, stream=_stream, **kwargs
838
900
  )
839
901
  )
840
902
 
841
903
  response = pipeline_response.http_response
842
904
 
843
905
  if response.status_code not in [200]:
906
+ if _stream:
907
+ await response.read() # Load the body in memory and close the socket
844
908
  map_error(
845
909
  status_code=response.status_code, response=response, error_map=error_map
846
910
  )
@@ -849,9 +913,9 @@ class ConfigOperations:
849
913
  deserialized = self._deserialize("object", pipeline_response)
850
914
 
851
915
  if cls:
852
- return cls(pipeline_response, deserialized, {})
916
+ return cls(pipeline_response, deserialized, {}) # type: ignore
853
917
 
854
- return deserialized
918
+ return deserialized # type: ignore
855
919
 
856
920
 
857
921
  class JobsOperations: # pylint: disable=too-many-public-methods
@@ -895,7 +959,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
895
959
  :rtype: ~client.models.SandboxDownloadResponse
896
960
  :raises ~azure.core.exceptions.HttpResponseError:
897
961
  """
898
- error_map = {
962
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
899
963
  401: ClientAuthenticationError,
900
964
  404: ResourceNotFoundError,
901
965
  409: ResourceExistsError,
@@ -908,23 +972,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
908
972
 
909
973
  cls: ClsType[_models.SandboxDownloadResponse] = kwargs.pop("cls", None)
910
974
 
911
- request = build_jobs_get_sandbox_file_request(
975
+ _request = build_jobs_get_sandbox_file_request(
912
976
  pfn=pfn,
913
977
  headers=_headers,
914
978
  params=_params,
915
979
  )
916
- request.url = self._client.format_url(request.url)
980
+ _request.url = self._client.format_url(_request.url)
917
981
 
918
982
  _stream = False
919
983
  pipeline_response: PipelineResponse = (
920
984
  await self._client._pipeline.run( # pylint: disable=protected-access
921
- request, stream=_stream, **kwargs
985
+ _request, stream=_stream, **kwargs
922
986
  )
923
987
  )
924
988
 
925
989
  response = pipeline_response.http_response
926
990
 
927
991
  if response.status_code not in [200]:
992
+ if _stream:
993
+ await response.read() # Load the body in memory and close the socket
928
994
  map_error(
929
995
  status_code=response.status_code, response=response, error_map=error_map
930
996
  )
@@ -933,9 +999,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
933
999
  deserialized = self._deserialize("SandboxDownloadResponse", pipeline_response)
934
1000
 
935
1001
  if cls:
936
- return cls(pipeline_response, deserialized, {})
1002
+ return cls(pipeline_response, deserialized, {}) # type: ignore
937
1003
 
938
- return deserialized
1004
+ return deserialized # type: ignore
939
1005
 
940
1006
  @overload
941
1007
  async def initiate_sandbox_upload(
@@ -967,7 +1033,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
967
1033
 
968
1034
  @overload
969
1035
  async def initiate_sandbox_upload(
970
- self, body: IO, *, content_type: str = "application/json", **kwargs: Any
1036
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
971
1037
  ) -> _models.SandboxUploadResponse:
972
1038
  """Initiate Sandbox Upload.
973
1039
 
@@ -980,7 +1046,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
980
1046
  should be used to upload the sandbox to the storage backend.
981
1047
 
982
1048
  :param body: Required.
983
- :type body: IO
1049
+ :type body: IO[bytes]
984
1050
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
985
1051
  Default value is "application/json".
986
1052
  :paramtype content_type: str
@@ -991,7 +1057,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
991
1057
 
992
1058
  @distributed_trace_async
993
1059
  async def initiate_sandbox_upload(
994
- self, body: Union[_models.SandboxInfo, IO], **kwargs: Any
1060
+ self, body: Union[_models.SandboxInfo, IO[bytes]], **kwargs: Any
995
1061
  ) -> _models.SandboxUploadResponse:
996
1062
  """Initiate Sandbox Upload.
997
1063
 
@@ -1003,16 +1069,13 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1003
1069
  If the sandbox does not exist in the database then the "url" and "fields"
1004
1070
  should be used to upload the sandbox to the storage backend.
1005
1071
 
1006
- :param body: Is either a SandboxInfo type or a IO type. Required.
1007
- :type body: ~client.models.SandboxInfo or IO
1008
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
1009
- Default value is None.
1010
- :paramtype content_type: str
1072
+ :param body: Is either a SandboxInfo type or a IO[bytes] type. Required.
1073
+ :type body: ~client.models.SandboxInfo or IO[bytes]
1011
1074
  :return: SandboxUploadResponse
1012
1075
  :rtype: ~client.models.SandboxUploadResponse
1013
1076
  :raises ~azure.core.exceptions.HttpResponseError:
1014
1077
  """
1015
- error_map = {
1078
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1016
1079
  401: ClientAuthenticationError,
1017
1080
  404: ResourceNotFoundError,
1018
1081
  409: ResourceExistsError,
@@ -1036,25 +1099,27 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1036
1099
  else:
1037
1100
  _json = self._serialize.body(body, "SandboxInfo")
1038
1101
 
1039
- request = build_jobs_initiate_sandbox_upload_request(
1102
+ _request = build_jobs_initiate_sandbox_upload_request(
1040
1103
  content_type=content_type,
1041
1104
  json=_json,
1042
1105
  content=_content,
1043
1106
  headers=_headers,
1044
1107
  params=_params,
1045
1108
  )
1046
- request.url = self._client.format_url(request.url)
1109
+ _request.url = self._client.format_url(_request.url)
1047
1110
 
1048
1111
  _stream = False
1049
1112
  pipeline_response: PipelineResponse = (
1050
1113
  await self._client._pipeline.run( # pylint: disable=protected-access
1051
- request, stream=_stream, **kwargs
1114
+ _request, stream=_stream, **kwargs
1052
1115
  )
1053
1116
  )
1054
1117
 
1055
1118
  response = pipeline_response.http_response
1056
1119
 
1057
1120
  if response.status_code not in [200]:
1121
+ if _stream:
1122
+ await response.read() # Load the body in memory and close the socket
1058
1123
  map_error(
1059
1124
  status_code=response.status_code, response=response, error_map=error_map
1060
1125
  )
@@ -1063,9 +1128,307 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1063
1128
  deserialized = self._deserialize("SandboxUploadResponse", pipeline_response)
1064
1129
 
1065
1130
  if cls:
1066
- return cls(pipeline_response, deserialized, {})
1131
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1132
+
1133
+ return deserialized # type: ignore
1134
+
1135
+ @distributed_trace_async
1136
+ async def unassign_bulk_jobs_sandboxes(
1137
+ self, *, jobs_ids: List[int], **kwargs: Any
1138
+ ) -> Any:
1139
+ """Unassign Bulk Jobs Sandboxes.
1140
+
1141
+ Delete bulk jobs sandbox mapping.
1142
+
1143
+ :keyword jobs_ids: Required.
1144
+ :paramtype jobs_ids: list[int]
1145
+ :return: any
1146
+ :rtype: any
1147
+ :raises ~azure.core.exceptions.HttpResponseError:
1148
+ """
1149
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1150
+ 401: ClientAuthenticationError,
1151
+ 404: ResourceNotFoundError,
1152
+ 409: ResourceExistsError,
1153
+ 304: ResourceNotModifiedError,
1154
+ }
1155
+ error_map.update(kwargs.pop("error_map", {}) or {})
1156
+
1157
+ _headers = kwargs.pop("headers", {}) or {}
1158
+ _params = kwargs.pop("params", {}) or {}
1159
+
1160
+ cls: ClsType[Any] = kwargs.pop("cls", None)
1161
+
1162
+ _request = build_jobs_unassign_bulk_jobs_sandboxes_request(
1163
+ jobs_ids=jobs_ids,
1164
+ headers=_headers,
1165
+ params=_params,
1166
+ )
1167
+ _request.url = self._client.format_url(_request.url)
1168
+
1169
+ _stream = False
1170
+ pipeline_response: PipelineResponse = (
1171
+ await self._client._pipeline.run( # pylint: disable=protected-access
1172
+ _request, stream=_stream, **kwargs
1173
+ )
1174
+ )
1175
+
1176
+ response = pipeline_response.http_response
1177
+
1178
+ if response.status_code not in [200]:
1179
+ if _stream:
1180
+ await response.read() # Load the body in memory and close the socket
1181
+ map_error(
1182
+ status_code=response.status_code, response=response, error_map=error_map
1183
+ )
1184
+ raise HttpResponseError(response=response)
1185
+
1186
+ deserialized = self._deserialize("object", pipeline_response)
1187
+
1188
+ if cls:
1189
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1190
+
1191
+ return deserialized # type: ignore
1192
+
1193
+ @distributed_trace_async
1194
+ async def get_job_sandboxes(
1195
+ self, job_id: int, **kwargs: Any
1196
+ ) -> Dict[str, List[Any]]:
1197
+ """Get Job Sandboxes.
1198
+
1199
+ Get input and output sandboxes of given job.
1200
+
1201
+ :param job_id: Required.
1202
+ :type job_id: int
1203
+ :return: dict mapping str to list of any
1204
+ :rtype: dict[str, list[any]]
1205
+ :raises ~azure.core.exceptions.HttpResponseError:
1206
+ """
1207
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1208
+ 401: ClientAuthenticationError,
1209
+ 404: ResourceNotFoundError,
1210
+ 409: ResourceExistsError,
1211
+ 304: ResourceNotModifiedError,
1212
+ }
1213
+ error_map.update(kwargs.pop("error_map", {}) or {})
1214
+
1215
+ _headers = kwargs.pop("headers", {}) or {}
1216
+ _params = kwargs.pop("params", {}) or {}
1217
+
1218
+ cls: ClsType[Dict[str, List[Any]]] = kwargs.pop("cls", None)
1219
+
1220
+ _request = build_jobs_get_job_sandboxes_request(
1221
+ job_id=job_id,
1222
+ headers=_headers,
1223
+ params=_params,
1224
+ )
1225
+ _request.url = self._client.format_url(_request.url)
1226
+
1227
+ _stream = False
1228
+ pipeline_response: PipelineResponse = (
1229
+ await self._client._pipeline.run( # pylint: disable=protected-access
1230
+ _request, stream=_stream, **kwargs
1231
+ )
1232
+ )
1233
+
1234
+ response = pipeline_response.http_response
1235
+
1236
+ if response.status_code not in [200]:
1237
+ if _stream:
1238
+ await response.read() # Load the body in memory and close the socket
1239
+ map_error(
1240
+ status_code=response.status_code, response=response, error_map=error_map
1241
+ )
1242
+ raise HttpResponseError(response=response)
1243
+
1244
+ deserialized = self._deserialize("{[object]}", pipeline_response)
1245
+
1246
+ if cls:
1247
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1248
+
1249
+ return deserialized # type: ignore
1250
+
1251
+ @distributed_trace_async
1252
+ async def unassign_job_sandboxes(self, job_id: int, **kwargs: Any) -> Any:
1253
+ """Unassign Job Sandboxes.
1254
+
1255
+ Delete single job sandbox mapping.
1256
+
1257
+ :param job_id: Required.
1258
+ :type job_id: int
1259
+ :return: any
1260
+ :rtype: any
1261
+ :raises ~azure.core.exceptions.HttpResponseError:
1262
+ """
1263
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1264
+ 401: ClientAuthenticationError,
1265
+ 404: ResourceNotFoundError,
1266
+ 409: ResourceExistsError,
1267
+ 304: ResourceNotModifiedError,
1268
+ }
1269
+ error_map.update(kwargs.pop("error_map", {}) or {})
1270
+
1271
+ _headers = kwargs.pop("headers", {}) or {}
1272
+ _params = kwargs.pop("params", {}) or {}
1273
+
1274
+ cls: ClsType[Any] = kwargs.pop("cls", None)
1275
+
1276
+ _request = build_jobs_unassign_job_sandboxes_request(
1277
+ job_id=job_id,
1278
+ headers=_headers,
1279
+ params=_params,
1280
+ )
1281
+ _request.url = self._client.format_url(_request.url)
1282
+
1283
+ _stream = False
1284
+ pipeline_response: PipelineResponse = (
1285
+ await self._client._pipeline.run( # pylint: disable=protected-access
1286
+ _request, stream=_stream, **kwargs
1287
+ )
1288
+ )
1289
+
1290
+ response = pipeline_response.http_response
1291
+
1292
+ if response.status_code not in [200]:
1293
+ if _stream:
1294
+ await response.read() # Load the body in memory and close the socket
1295
+ map_error(
1296
+ status_code=response.status_code, response=response, error_map=error_map
1297
+ )
1298
+ raise HttpResponseError(response=response)
1299
+
1300
+ deserialized = self._deserialize("object", pipeline_response)
1301
+
1302
+ if cls:
1303
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1304
+
1305
+ return deserialized # type: ignore
1306
+
1307
+ @distributed_trace_async
1308
+ async def get_job_sandbox(
1309
+ self, job_id: int, sandbox_type: Union[str, _models.SandboxType], **kwargs: Any
1310
+ ) -> List[Any]:
1311
+ """Get Job Sandbox.
1312
+
1313
+ Get input or output sandbox of given job.
1314
+
1315
+ :param job_id: Required.
1316
+ :type job_id: int
1317
+ :param sandbox_type: Known values are: "input" and "output". Required.
1318
+ :type sandbox_type: str or ~client.models.SandboxType
1319
+ :return: list of any
1320
+ :rtype: list[any]
1321
+ :raises ~azure.core.exceptions.HttpResponseError:
1322
+ """
1323
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1324
+ 401: ClientAuthenticationError,
1325
+ 404: ResourceNotFoundError,
1326
+ 409: ResourceExistsError,
1327
+ 304: ResourceNotModifiedError,
1328
+ }
1329
+ error_map.update(kwargs.pop("error_map", {}) or {})
1330
+
1331
+ _headers = kwargs.pop("headers", {}) or {}
1332
+ _params = kwargs.pop("params", {}) or {}
1333
+
1334
+ cls: ClsType[List[Any]] = kwargs.pop("cls", None)
1335
+
1336
+ _request = build_jobs_get_job_sandbox_request(
1337
+ job_id=job_id,
1338
+ sandbox_type=sandbox_type,
1339
+ headers=_headers,
1340
+ params=_params,
1341
+ )
1342
+ _request.url = self._client.format_url(_request.url)
1343
+
1344
+ _stream = False
1345
+ pipeline_response: PipelineResponse = (
1346
+ await self._client._pipeline.run( # pylint: disable=protected-access
1347
+ _request, stream=_stream, **kwargs
1348
+ )
1349
+ )
1350
+
1351
+ response = pipeline_response.http_response
1352
+
1353
+ if response.status_code not in [200]:
1354
+ if _stream:
1355
+ await response.read() # Load the body in memory and close the socket
1356
+ map_error(
1357
+ status_code=response.status_code, response=response, error_map=error_map
1358
+ )
1359
+ raise HttpResponseError(response=response)
1360
+
1361
+ deserialized = self._deserialize("[object]", pipeline_response)
1362
+
1363
+ if cls:
1364
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1365
+
1366
+ return deserialized # type: ignore
1367
+
1368
+ @distributed_trace_async
1369
+ async def assign_sandbox_to_job(self, job_id: int, body: str, **kwargs: Any) -> Any:
1370
+ """Assign Sandbox To Job.
1371
+
1372
+ Mapp the pfn as output sandbox to job.
1373
+
1374
+ :param job_id: Required.
1375
+ :type job_id: int
1376
+ :param body: Required.
1377
+ :type body: str
1378
+ :return: any
1379
+ :rtype: any
1380
+ :raises ~azure.core.exceptions.HttpResponseError:
1381
+ """
1382
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1383
+ 401: ClientAuthenticationError,
1384
+ 404: ResourceNotFoundError,
1385
+ 409: ResourceExistsError,
1386
+ 304: ResourceNotModifiedError,
1387
+ }
1388
+ error_map.update(kwargs.pop("error_map", {}) or {})
1389
+
1390
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
1391
+ _params = kwargs.pop("params", {}) or {}
1392
+
1393
+ content_type: str = kwargs.pop(
1394
+ "content_type", _headers.pop("Content-Type", "application/json")
1395
+ )
1396
+ cls: ClsType[Any] = kwargs.pop("cls", None)
1397
+
1398
+ _content = self._serialize.body(body, "str")
1399
+
1400
+ _request = build_jobs_assign_sandbox_to_job_request(
1401
+ job_id=job_id,
1402
+ content_type=content_type,
1403
+ content=_content,
1404
+ headers=_headers,
1405
+ params=_params,
1406
+ )
1407
+ _request.url = self._client.format_url(_request.url)
1408
+
1409
+ _stream = False
1410
+ pipeline_response: PipelineResponse = (
1411
+ await self._client._pipeline.run( # pylint: disable=protected-access
1412
+ _request, stream=_stream, **kwargs
1413
+ )
1414
+ )
1415
+
1416
+ response = pipeline_response.http_response
1417
+
1418
+ if response.status_code not in [200]:
1419
+ if _stream:
1420
+ await response.read() # Load the body in memory and close the socket
1421
+ map_error(
1422
+ status_code=response.status_code, response=response, error_map=error_map
1423
+ )
1424
+ raise HttpResponseError(response=response)
1425
+
1426
+ deserialized = self._deserialize("object", pipeline_response)
1427
+
1428
+ if cls:
1429
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1067
1430
 
1068
- return deserialized
1431
+ return deserialized # type: ignore
1069
1432
 
1070
1433
  @overload
1071
1434
  async def submit_bulk_jobs(
@@ -1087,14 +1450,14 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1087
1450
 
1088
1451
  @overload
1089
1452
  async def submit_bulk_jobs(
1090
- self, body: IO, *, content_type: str = "application/json", **kwargs: Any
1453
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
1091
1454
  ) -> List[_models.InsertedJob]:
1092
1455
  """Submit Bulk Jobs.
1093
1456
 
1094
1457
  Submit Bulk Jobs.
1095
1458
 
1096
1459
  :param body: Required.
1097
- :type body: IO
1460
+ :type body: IO[bytes]
1098
1461
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1099
1462
  Default value is "application/json".
1100
1463
  :paramtype content_type: str
@@ -1105,22 +1468,19 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1105
1468
 
1106
1469
  @distributed_trace_async
1107
1470
  async def submit_bulk_jobs(
1108
- self, body: Union[List[str], IO], **kwargs: Any
1471
+ self, body: Union[List[str], IO[bytes]], **kwargs: Any
1109
1472
  ) -> List[_models.InsertedJob]:
1110
1473
  """Submit Bulk Jobs.
1111
1474
 
1112
1475
  Submit Bulk Jobs.
1113
1476
 
1114
- :param body: Is either a [str] type or a IO type. Required.
1115
- :type body: list[str] or IO
1116
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
1117
- Default value is None.
1118
- :paramtype content_type: str
1477
+ :param body: Is either a [str] type or a IO[bytes] type. Required.
1478
+ :type body: list[str] or IO[bytes]
1119
1479
  :return: list of InsertedJob
1120
1480
  :rtype: list[~client.models.InsertedJob]
1121
1481
  :raises ~azure.core.exceptions.HttpResponseError:
1122
1482
  """
1123
- error_map = {
1483
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1124
1484
  401: ClientAuthenticationError,
1125
1485
  404: ResourceNotFoundError,
1126
1486
  409: ResourceExistsError,
@@ -1144,25 +1504,27 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1144
1504
  else:
1145
1505
  _json = self._serialize.body(body, "[str]")
1146
1506
 
1147
- request = build_jobs_submit_bulk_jobs_request(
1507
+ _request = build_jobs_submit_bulk_jobs_request(
1148
1508
  content_type=content_type,
1149
1509
  json=_json,
1150
1510
  content=_content,
1151
1511
  headers=_headers,
1152
1512
  params=_params,
1153
1513
  )
1154
- request.url = self._client.format_url(request.url)
1514
+ _request.url = self._client.format_url(_request.url)
1155
1515
 
1156
1516
  _stream = False
1157
1517
  pipeline_response: PipelineResponse = (
1158
1518
  await self._client._pipeline.run( # pylint: disable=protected-access
1159
- request, stream=_stream, **kwargs
1519
+ _request, stream=_stream, **kwargs
1160
1520
  )
1161
1521
  )
1162
1522
 
1163
1523
  response = pipeline_response.http_response
1164
1524
 
1165
1525
  if response.status_code not in [200]:
1526
+ if _stream:
1527
+ await response.read() # Load the body in memory and close the socket
1166
1528
  map_error(
1167
1529
  status_code=response.status_code, response=response, error_map=error_map
1168
1530
  )
@@ -1171,9 +1533,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1171
1533
  deserialized = self._deserialize("[InsertedJob]", pipeline_response)
1172
1534
 
1173
1535
  if cls:
1174
- return cls(pipeline_response, deserialized, {})
1536
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1175
1537
 
1176
- return deserialized
1538
+ return deserialized # type: ignore
1177
1539
 
1178
1540
  @distributed_trace_async
1179
1541
  async def delete_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
@@ -1187,7 +1549,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1187
1549
  :rtype: any
1188
1550
  :raises ~azure.core.exceptions.HttpResponseError:
1189
1551
  """
1190
- error_map = {
1552
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1191
1553
  401: ClientAuthenticationError,
1192
1554
  404: ResourceNotFoundError,
1193
1555
  409: ResourceExistsError,
@@ -1200,23 +1562,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1200
1562
 
1201
1563
  cls: ClsType[Any] = kwargs.pop("cls", None)
1202
1564
 
1203
- request = build_jobs_delete_bulk_jobs_request(
1565
+ _request = build_jobs_delete_bulk_jobs_request(
1204
1566
  job_ids=job_ids,
1205
1567
  headers=_headers,
1206
1568
  params=_params,
1207
1569
  )
1208
- request.url = self._client.format_url(request.url)
1570
+ _request.url = self._client.format_url(_request.url)
1209
1571
 
1210
1572
  _stream = False
1211
1573
  pipeline_response: PipelineResponse = (
1212
1574
  await self._client._pipeline.run( # pylint: disable=protected-access
1213
- request, stream=_stream, **kwargs
1575
+ _request, stream=_stream, **kwargs
1214
1576
  )
1215
1577
  )
1216
1578
 
1217
1579
  response = pipeline_response.http_response
1218
1580
 
1219
1581
  if response.status_code not in [200]:
1582
+ if _stream:
1583
+ await response.read() # Load the body in memory and close the socket
1220
1584
  map_error(
1221
1585
  status_code=response.status_code, response=response, error_map=error_map
1222
1586
  )
@@ -1225,9 +1589,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1225
1589
  deserialized = self._deserialize("object", pipeline_response)
1226
1590
 
1227
1591
  if cls:
1228
- return cls(pipeline_response, deserialized, {})
1592
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1229
1593
 
1230
- return deserialized
1594
+ return deserialized # type: ignore
1231
1595
 
1232
1596
  @distributed_trace_async
1233
1597
  async def kill_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
@@ -1241,7 +1605,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1241
1605
  :rtype: any
1242
1606
  :raises ~azure.core.exceptions.HttpResponseError:
1243
1607
  """
1244
- error_map = {
1608
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1245
1609
  401: ClientAuthenticationError,
1246
1610
  404: ResourceNotFoundError,
1247
1611
  409: ResourceExistsError,
@@ -1254,23 +1618,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1254
1618
 
1255
1619
  cls: ClsType[Any] = kwargs.pop("cls", None)
1256
1620
 
1257
- request = build_jobs_kill_bulk_jobs_request(
1621
+ _request = build_jobs_kill_bulk_jobs_request(
1258
1622
  job_ids=job_ids,
1259
1623
  headers=_headers,
1260
1624
  params=_params,
1261
1625
  )
1262
- request.url = self._client.format_url(request.url)
1626
+ _request.url = self._client.format_url(_request.url)
1263
1627
 
1264
1628
  _stream = False
1265
1629
  pipeline_response: PipelineResponse = (
1266
1630
  await self._client._pipeline.run( # pylint: disable=protected-access
1267
- request, stream=_stream, **kwargs
1631
+ _request, stream=_stream, **kwargs
1268
1632
  )
1269
1633
  )
1270
1634
 
1271
1635
  response = pipeline_response.http_response
1272
1636
 
1273
1637
  if response.status_code not in [200]:
1638
+ if _stream:
1639
+ await response.read() # Load the body in memory and close the socket
1274
1640
  map_error(
1275
1641
  status_code=response.status_code, response=response, error_map=error_map
1276
1642
  )
@@ -1279,9 +1645,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1279
1645
  deserialized = self._deserialize("object", pipeline_response)
1280
1646
 
1281
1647
  if cls:
1282
- return cls(pipeline_response, deserialized, {})
1648
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1283
1649
 
1284
- return deserialized
1650
+ return deserialized # type: ignore
1285
1651
 
1286
1652
  @distributed_trace_async
1287
1653
  async def remove_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
@@ -1299,7 +1665,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1299
1665
  :rtype: any
1300
1666
  :raises ~azure.core.exceptions.HttpResponseError:
1301
1667
  """
1302
- error_map = {
1668
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1303
1669
  401: ClientAuthenticationError,
1304
1670
  404: ResourceNotFoundError,
1305
1671
  409: ResourceExistsError,
@@ -1312,23 +1678,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1312
1678
 
1313
1679
  cls: ClsType[Any] = kwargs.pop("cls", None)
1314
1680
 
1315
- request = build_jobs_remove_bulk_jobs_request(
1681
+ _request = build_jobs_remove_bulk_jobs_request(
1316
1682
  job_ids=job_ids,
1317
1683
  headers=_headers,
1318
1684
  params=_params,
1319
1685
  )
1320
- request.url = self._client.format_url(request.url)
1686
+ _request.url = self._client.format_url(_request.url)
1321
1687
 
1322
1688
  _stream = False
1323
1689
  pipeline_response: PipelineResponse = (
1324
1690
  await self._client._pipeline.run( # pylint: disable=protected-access
1325
- request, stream=_stream, **kwargs
1691
+ _request, stream=_stream, **kwargs
1326
1692
  )
1327
1693
  )
1328
1694
 
1329
1695
  response = pipeline_response.http_response
1330
1696
 
1331
1697
  if response.status_code not in [200]:
1698
+ if _stream:
1699
+ await response.read() # Load the body in memory and close the socket
1332
1700
  map_error(
1333
1701
  status_code=response.status_code, response=response, error_map=error_map
1334
1702
  )
@@ -1337,9 +1705,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1337
1705
  deserialized = self._deserialize("object", pipeline_response)
1338
1706
 
1339
1707
  if cls:
1340
- return cls(pipeline_response, deserialized, {})
1708
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1341
1709
 
1342
- return deserialized
1710
+ return deserialized # type: ignore
1343
1711
 
1344
1712
  @distributed_trace_async
1345
1713
  async def get_job_status_bulk(
@@ -1355,7 +1723,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1355
1723
  :rtype: dict[str, ~client.models.LimitedJobStatusReturn]
1356
1724
  :raises ~azure.core.exceptions.HttpResponseError:
1357
1725
  """
1358
- error_map = {
1726
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1359
1727
  401: ClientAuthenticationError,
1360
1728
  404: ResourceNotFoundError,
1361
1729
  409: ResourceExistsError,
@@ -1370,23 +1738,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1370
1738
  "cls", None
1371
1739
  )
1372
1740
 
1373
- request = build_jobs_get_job_status_bulk_request(
1741
+ _request = build_jobs_get_job_status_bulk_request(
1374
1742
  job_ids=job_ids,
1375
1743
  headers=_headers,
1376
1744
  params=_params,
1377
1745
  )
1378
- request.url = self._client.format_url(request.url)
1746
+ _request.url = self._client.format_url(_request.url)
1379
1747
 
1380
1748
  _stream = False
1381
1749
  pipeline_response: PipelineResponse = (
1382
1750
  await self._client._pipeline.run( # pylint: disable=protected-access
1383
- request, stream=_stream, **kwargs
1751
+ _request, stream=_stream, **kwargs
1384
1752
  )
1385
1753
  )
1386
1754
 
1387
1755
  response = pipeline_response.http_response
1388
1756
 
1389
1757
  if response.status_code not in [200]:
1758
+ if _stream:
1759
+ await response.read() # Load the body in memory and close the socket
1390
1760
  map_error(
1391
1761
  status_code=response.status_code, response=response, error_map=error_map
1392
1762
  )
@@ -1395,9 +1765,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1395
1765
  deserialized = self._deserialize("{LimitedJobStatusReturn}", pipeline_response)
1396
1766
 
1397
1767
  if cls:
1398
- return cls(pipeline_response, deserialized, {})
1768
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1399
1769
 
1400
- return deserialized
1770
+ return deserialized # type: ignore
1401
1771
 
1402
1772
  @overload
1403
1773
  async def set_job_status_bulk(
@@ -1427,7 +1797,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1427
1797
  @overload
1428
1798
  async def set_job_status_bulk(
1429
1799
  self,
1430
- body: IO,
1800
+ body: IO[bytes],
1431
1801
  *,
1432
1802
  force: bool = False,
1433
1803
  content_type: str = "application/json",
@@ -1438,7 +1808,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1438
1808
  Set Job Status Bulk.
1439
1809
 
1440
1810
  :param body: Required.
1441
- :type body: IO
1811
+ :type body: IO[bytes]
1442
1812
  :keyword force: Default value is False.
1443
1813
  :paramtype force: bool
1444
1814
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -1452,7 +1822,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1452
1822
  @distributed_trace_async
1453
1823
  async def set_job_status_bulk(
1454
1824
  self,
1455
- body: Union[Dict[str, Dict[str, _models.JobStatusUpdate]], IO],
1825
+ body: Union[Dict[str, Dict[str, _models.JobStatusUpdate]], IO[bytes]],
1456
1826
  *,
1457
1827
  force: bool = False,
1458
1828
  **kwargs: Any,
@@ -1461,18 +1831,15 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1461
1831
 
1462
1832
  Set Job Status Bulk.
1463
1833
 
1464
- :param body: Is either a {str: {str: JobStatusUpdate}} type or a IO type. Required.
1465
- :type body: dict[str, dict[str, ~client.models.JobStatusUpdate]] or IO
1834
+ :param body: Is either a {str: {str: JobStatusUpdate}} type or a IO[bytes] type. Required.
1835
+ :type body: dict[str, dict[str, ~client.models.JobStatusUpdate]] or IO[bytes]
1466
1836
  :keyword force: Default value is False.
1467
1837
  :paramtype force: bool
1468
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
1469
- Default value is None.
1470
- :paramtype content_type: str
1471
1838
  :return: dict mapping str to SetJobStatusReturn
1472
1839
  :rtype: dict[str, ~client.models.SetJobStatusReturn]
1473
1840
  :raises ~azure.core.exceptions.HttpResponseError:
1474
1841
  """
1475
- error_map = {
1842
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1476
1843
  401: ClientAuthenticationError,
1477
1844
  404: ResourceNotFoundError,
1478
1845
  409: ResourceExistsError,
@@ -1496,7 +1863,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1496
1863
  else:
1497
1864
  _json = self._serialize.body(body, "{{JobStatusUpdate}}")
1498
1865
 
1499
- request = build_jobs_set_job_status_bulk_request(
1866
+ _request = build_jobs_set_job_status_bulk_request(
1500
1867
  force=force,
1501
1868
  content_type=content_type,
1502
1869
  json=_json,
@@ -1504,18 +1871,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1504
1871
  headers=_headers,
1505
1872
  params=_params,
1506
1873
  )
1507
- request.url = self._client.format_url(request.url)
1874
+ _request.url = self._client.format_url(_request.url)
1508
1875
 
1509
1876
  _stream = False
1510
1877
  pipeline_response: PipelineResponse = (
1511
1878
  await self._client._pipeline.run( # pylint: disable=protected-access
1512
- request, stream=_stream, **kwargs
1879
+ _request, stream=_stream, **kwargs
1513
1880
  )
1514
1881
  )
1515
1882
 
1516
1883
  response = pipeline_response.http_response
1517
1884
 
1518
1885
  if response.status_code not in [200]:
1886
+ if _stream:
1887
+ await response.read() # Load the body in memory and close the socket
1519
1888
  map_error(
1520
1889
  status_code=response.status_code, response=response, error_map=error_map
1521
1890
  )
@@ -1524,9 +1893,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1524
1893
  deserialized = self._deserialize("{SetJobStatusReturn}", pipeline_response)
1525
1894
 
1526
1895
  if cls:
1527
- return cls(pipeline_response, deserialized, {})
1896
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1528
1897
 
1529
- return deserialized
1898
+ return deserialized # type: ignore
1530
1899
 
1531
1900
  @distributed_trace_async
1532
1901
  async def get_job_status_history_bulk(
@@ -1542,7 +1911,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1542
1911
  :rtype: dict[str, list[~client.models.JobStatusReturn]]
1543
1912
  :raises ~azure.core.exceptions.HttpResponseError:
1544
1913
  """
1545
- error_map = {
1914
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1546
1915
  401: ClientAuthenticationError,
1547
1916
  404: ResourceNotFoundError,
1548
1917
  409: ResourceExistsError,
@@ -1555,23 +1924,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1555
1924
 
1556
1925
  cls: ClsType[Dict[str, List[_models.JobStatusReturn]]] = kwargs.pop("cls", None)
1557
1926
 
1558
- request = build_jobs_get_job_status_history_bulk_request(
1927
+ _request = build_jobs_get_job_status_history_bulk_request(
1559
1928
  job_ids=job_ids,
1560
1929
  headers=_headers,
1561
1930
  params=_params,
1562
1931
  )
1563
- request.url = self._client.format_url(request.url)
1932
+ _request.url = self._client.format_url(_request.url)
1564
1933
 
1565
1934
  _stream = False
1566
1935
  pipeline_response: PipelineResponse = (
1567
1936
  await self._client._pipeline.run( # pylint: disable=protected-access
1568
- request, stream=_stream, **kwargs
1937
+ _request, stream=_stream, **kwargs
1569
1938
  )
1570
1939
  )
1571
1940
 
1572
1941
  response = pipeline_response.http_response
1573
1942
 
1574
1943
  if response.status_code not in [200]:
1944
+ if _stream:
1945
+ await response.read() # Load the body in memory and close the socket
1575
1946
  map_error(
1576
1947
  status_code=response.status_code, response=response, error_map=error_map
1577
1948
  )
@@ -1580,9 +1951,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1580
1951
  deserialized = self._deserialize("{[JobStatusReturn]}", pipeline_response)
1581
1952
 
1582
1953
  if cls:
1583
- return cls(pipeline_response, deserialized, {})
1954
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1584
1955
 
1585
- return deserialized
1956
+ return deserialized # type: ignore
1586
1957
 
1587
1958
  @distributed_trace_async
1588
1959
  async def reschedule_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
@@ -1596,7 +1967,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1596
1967
  :rtype: any
1597
1968
  :raises ~azure.core.exceptions.HttpResponseError:
1598
1969
  """
1599
- error_map = {
1970
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1600
1971
  401: ClientAuthenticationError,
1601
1972
  404: ResourceNotFoundError,
1602
1973
  409: ResourceExistsError,
@@ -1609,23 +1980,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1609
1980
 
1610
1981
  cls: ClsType[Any] = kwargs.pop("cls", None)
1611
1982
 
1612
- request = build_jobs_reschedule_bulk_jobs_request(
1983
+ _request = build_jobs_reschedule_bulk_jobs_request(
1613
1984
  job_ids=job_ids,
1614
1985
  headers=_headers,
1615
1986
  params=_params,
1616
1987
  )
1617
- request.url = self._client.format_url(request.url)
1988
+ _request.url = self._client.format_url(_request.url)
1618
1989
 
1619
1990
  _stream = False
1620
1991
  pipeline_response: PipelineResponse = (
1621
1992
  await self._client._pipeline.run( # pylint: disable=protected-access
1622
- request, stream=_stream, **kwargs
1993
+ _request, stream=_stream, **kwargs
1623
1994
  )
1624
1995
  )
1625
1996
 
1626
1997
  response = pipeline_response.http_response
1627
1998
 
1628
1999
  if response.status_code not in [200]:
2000
+ if _stream:
2001
+ await response.read() # Load the body in memory and close the socket
1629
2002
  map_error(
1630
2003
  status_code=response.status_code, response=response, error_map=error_map
1631
2004
  )
@@ -1634,9 +2007,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1634
2007
  deserialized = self._deserialize("object", pipeline_response)
1635
2008
 
1636
2009
  if cls:
1637
- return cls(pipeline_response, deserialized, {})
2010
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1638
2011
 
1639
- return deserialized
2012
+ return deserialized # type: ignore
1640
2013
 
1641
2014
  @distributed_trace_async
1642
2015
  async def reschedule_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -1650,7 +2023,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1650
2023
  :rtype: any
1651
2024
  :raises ~azure.core.exceptions.HttpResponseError:
1652
2025
  """
1653
- error_map = {
2026
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1654
2027
  401: ClientAuthenticationError,
1655
2028
  404: ResourceNotFoundError,
1656
2029
  409: ResourceExistsError,
@@ -1663,23 +2036,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1663
2036
 
1664
2037
  cls: ClsType[Any] = kwargs.pop("cls", None)
1665
2038
 
1666
- request = build_jobs_reschedule_single_job_request(
2039
+ _request = build_jobs_reschedule_single_job_request(
1667
2040
  job_id=job_id,
1668
2041
  headers=_headers,
1669
2042
  params=_params,
1670
2043
  )
1671
- request.url = self._client.format_url(request.url)
2044
+ _request.url = self._client.format_url(_request.url)
1672
2045
 
1673
2046
  _stream = False
1674
2047
  pipeline_response: PipelineResponse = (
1675
2048
  await self._client._pipeline.run( # pylint: disable=protected-access
1676
- request, stream=_stream, **kwargs
2049
+ _request, stream=_stream, **kwargs
1677
2050
  )
1678
2051
  )
1679
2052
 
1680
2053
  response = pipeline_response.http_response
1681
2054
 
1682
2055
  if response.status_code not in [200]:
2056
+ if _stream:
2057
+ await response.read() # Load the body in memory and close the socket
1683
2058
  map_error(
1684
2059
  status_code=response.status_code, response=response, error_map=error_map
1685
2060
  )
@@ -1688,9 +2063,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1688
2063
  deserialized = self._deserialize("object", pipeline_response)
1689
2064
 
1690
2065
  if cls:
1691
- return cls(pipeline_response, deserialized, {})
2066
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1692
2067
 
1693
- return deserialized
2068
+ return deserialized # type: ignore
1694
2069
 
1695
2070
  @overload
1696
2071
  async def search(
@@ -1725,7 +2100,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1725
2100
  @overload
1726
2101
  async def search(
1727
2102
  self,
1728
- body: Optional[IO] = None,
2103
+ body: Optional[IO[bytes]] = None,
1729
2104
  *,
1730
2105
  page: int = 0,
1731
2106
  per_page: int = 100,
@@ -1739,7 +2114,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1739
2114
  **TODO: Add more docs**.
1740
2115
 
1741
2116
  :param body: Default value is None.
1742
- :type body: IO
2117
+ :type body: IO[bytes]
1743
2118
  :keyword page: Default value is 0.
1744
2119
  :paramtype page: int
1745
2120
  :keyword per_page: Default value is 100.
@@ -1755,7 +2130,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1755
2130
  @distributed_trace_async
1756
2131
  async def search(
1757
2132
  self,
1758
- body: Optional[Union[_models.JobSearchParams, IO]] = None,
2133
+ body: Optional[Union[_models.JobSearchParams, IO[bytes]]] = None,
1759
2134
  *,
1760
2135
  page: int = 0,
1761
2136
  per_page: int = 100,
@@ -1767,20 +2142,17 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1767
2142
 
1768
2143
  **TODO: Add more docs**.
1769
2144
 
1770
- :param body: Is either a JobSearchParams type or a IO type. Default value is None.
1771
- :type body: ~client.models.JobSearchParams or IO
2145
+ :param body: Is either a JobSearchParams type or a IO[bytes] type. Default value is None.
2146
+ :type body: ~client.models.JobSearchParams or IO[bytes]
1772
2147
  :keyword page: Default value is 0.
1773
2148
  :paramtype page: int
1774
2149
  :keyword per_page: Default value is 100.
1775
2150
  :paramtype per_page: int
1776
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
1777
- Default value is None.
1778
- :paramtype content_type: str
1779
2151
  :return: list of JSON
1780
2152
  :rtype: list[JSON]
1781
2153
  :raises ~azure.core.exceptions.HttpResponseError:
1782
2154
  """
1783
- error_map = {
2155
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1784
2156
  401: ClientAuthenticationError,
1785
2157
  404: ResourceNotFoundError,
1786
2158
  409: ResourceExistsError,
@@ -1807,7 +2179,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1807
2179
  else:
1808
2180
  _json = None
1809
2181
 
1810
- request = build_jobs_search_request(
2182
+ _request = build_jobs_search_request(
1811
2183
  page=page,
1812
2184
  per_page=per_page,
1813
2185
  content_type=content_type,
@@ -1816,18 +2188,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1816
2188
  headers=_headers,
1817
2189
  params=_params,
1818
2190
  )
1819
- request.url = self._client.format_url(request.url)
2191
+ _request.url = self._client.format_url(_request.url)
1820
2192
 
1821
2193
  _stream = False
1822
2194
  pipeline_response: PipelineResponse = (
1823
2195
  await self._client._pipeline.run( # pylint: disable=protected-access
1824
- request, stream=_stream, **kwargs
2196
+ _request, stream=_stream, **kwargs
1825
2197
  )
1826
2198
  )
1827
2199
 
1828
2200
  response = pipeline_response.http_response
1829
2201
 
1830
2202
  if response.status_code not in [200]:
2203
+ if _stream:
2204
+ await response.read() # Load the body in memory and close the socket
1831
2205
  map_error(
1832
2206
  status_code=response.status_code, response=response, error_map=error_map
1833
2207
  )
@@ -1836,9 +2210,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1836
2210
  deserialized = self._deserialize("[object]", pipeline_response)
1837
2211
 
1838
2212
  if cls:
1839
- return cls(pipeline_response, deserialized, {})
2213
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1840
2214
 
1841
- return deserialized
2215
+ return deserialized # type: ignore
1842
2216
 
1843
2217
  @overload
1844
2218
  async def summary(
@@ -1864,14 +2238,14 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1864
2238
 
1865
2239
  @overload
1866
2240
  async def summary(
1867
- self, body: IO, *, content_type: str = "application/json", **kwargs: Any
2241
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
1868
2242
  ) -> Any:
1869
2243
  """Summary.
1870
2244
 
1871
2245
  Show information suitable for plotting.
1872
2246
 
1873
2247
  :param body: Required.
1874
- :type body: IO
2248
+ :type body: IO[bytes]
1875
2249
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1876
2250
  Default value is "application/json".
1877
2251
  :paramtype content_type: str
@@ -1882,22 +2256,19 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1882
2256
 
1883
2257
  @distributed_trace_async
1884
2258
  async def summary(
1885
- self, body: Union[_models.JobSummaryParams, IO], **kwargs: Any
2259
+ self, body: Union[_models.JobSummaryParams, IO[bytes]], **kwargs: Any
1886
2260
  ) -> Any:
1887
2261
  """Summary.
1888
2262
 
1889
2263
  Show information suitable for plotting.
1890
2264
 
1891
- :param body: Is either a JobSummaryParams type or a IO type. Required.
1892
- :type body: ~client.models.JobSummaryParams or IO
1893
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
1894
- Default value is None.
1895
- :paramtype content_type: str
2265
+ :param body: Is either a JobSummaryParams type or a IO[bytes] type. Required.
2266
+ :type body: ~client.models.JobSummaryParams or IO[bytes]
1896
2267
  :return: any
1897
2268
  :rtype: any
1898
2269
  :raises ~azure.core.exceptions.HttpResponseError:
1899
2270
  """
1900
- error_map = {
2271
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1901
2272
  401: ClientAuthenticationError,
1902
2273
  404: ResourceNotFoundError,
1903
2274
  409: ResourceExistsError,
@@ -1921,25 +2292,27 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1921
2292
  else:
1922
2293
  _json = self._serialize.body(body, "JobSummaryParams")
1923
2294
 
1924
- request = build_jobs_summary_request(
2295
+ _request = build_jobs_summary_request(
1925
2296
  content_type=content_type,
1926
2297
  json=_json,
1927
2298
  content=_content,
1928
2299
  headers=_headers,
1929
2300
  params=_params,
1930
2301
  )
1931
- request.url = self._client.format_url(request.url)
2302
+ _request.url = self._client.format_url(_request.url)
1932
2303
 
1933
2304
  _stream = False
1934
2305
  pipeline_response: PipelineResponse = (
1935
2306
  await self._client._pipeline.run( # pylint: disable=protected-access
1936
- request, stream=_stream, **kwargs
2307
+ _request, stream=_stream, **kwargs
1937
2308
  )
1938
2309
  )
1939
2310
 
1940
2311
  response = pipeline_response.http_response
1941
2312
 
1942
2313
  if response.status_code not in [200]:
2314
+ if _stream:
2315
+ await response.read() # Load the body in memory and close the socket
1943
2316
  map_error(
1944
2317
  status_code=response.status_code, response=response, error_map=error_map
1945
2318
  )
@@ -1948,9 +2321,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1948
2321
  deserialized = self._deserialize("object", pipeline_response)
1949
2322
 
1950
2323
  if cls:
1951
- return cls(pipeline_response, deserialized, {})
2324
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1952
2325
 
1953
- return deserialized
2326
+ return deserialized # type: ignore
1954
2327
 
1955
2328
  @distributed_trace_async
1956
2329
  async def get_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -1964,7 +2337,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1964
2337
  :rtype: any
1965
2338
  :raises ~azure.core.exceptions.HttpResponseError:
1966
2339
  """
1967
- error_map = {
2340
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
1968
2341
  401: ClientAuthenticationError,
1969
2342
  404: ResourceNotFoundError,
1970
2343
  409: ResourceExistsError,
@@ -1977,23 +2350,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1977
2350
 
1978
2351
  cls: ClsType[Any] = kwargs.pop("cls", None)
1979
2352
 
1980
- request = build_jobs_get_single_job_request(
2353
+ _request = build_jobs_get_single_job_request(
1981
2354
  job_id=job_id,
1982
2355
  headers=_headers,
1983
2356
  params=_params,
1984
2357
  )
1985
- request.url = self._client.format_url(request.url)
2358
+ _request.url = self._client.format_url(_request.url)
1986
2359
 
1987
2360
  _stream = False
1988
2361
  pipeline_response: PipelineResponse = (
1989
2362
  await self._client._pipeline.run( # pylint: disable=protected-access
1990
- request, stream=_stream, **kwargs
2363
+ _request, stream=_stream, **kwargs
1991
2364
  )
1992
2365
  )
1993
2366
 
1994
2367
  response = pipeline_response.http_response
1995
2368
 
1996
2369
  if response.status_code not in [200]:
2370
+ if _stream:
2371
+ await response.read() # Load the body in memory and close the socket
1997
2372
  map_error(
1998
2373
  status_code=response.status_code, response=response, error_map=error_map
1999
2374
  )
@@ -2002,9 +2377,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2002
2377
  deserialized = self._deserialize("object", pipeline_response)
2003
2378
 
2004
2379
  if cls:
2005
- return cls(pipeline_response, deserialized, {})
2380
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2006
2381
 
2007
- return deserialized
2382
+ return deserialized # type: ignore
2008
2383
 
2009
2384
  @distributed_trace_async
2010
2385
  async def delete_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2018,7 +2393,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2018
2393
  :rtype: any
2019
2394
  :raises ~azure.core.exceptions.HttpResponseError:
2020
2395
  """
2021
- error_map = {
2396
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2022
2397
  401: ClientAuthenticationError,
2023
2398
  404: ResourceNotFoundError,
2024
2399
  409: ResourceExistsError,
@@ -2031,23 +2406,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2031
2406
 
2032
2407
  cls: ClsType[Any] = kwargs.pop("cls", None)
2033
2408
 
2034
- request = build_jobs_delete_single_job_request(
2409
+ _request = build_jobs_delete_single_job_request(
2035
2410
  job_id=job_id,
2036
2411
  headers=_headers,
2037
2412
  params=_params,
2038
2413
  )
2039
- request.url = self._client.format_url(request.url)
2414
+ _request.url = self._client.format_url(_request.url)
2040
2415
 
2041
2416
  _stream = False
2042
2417
  pipeline_response: PipelineResponse = (
2043
2418
  await self._client._pipeline.run( # pylint: disable=protected-access
2044
- request, stream=_stream, **kwargs
2419
+ _request, stream=_stream, **kwargs
2045
2420
  )
2046
2421
  )
2047
2422
 
2048
2423
  response = pipeline_response.http_response
2049
2424
 
2050
2425
  if response.status_code not in [200]:
2426
+ if _stream:
2427
+ await response.read() # Load the body in memory and close the socket
2051
2428
  map_error(
2052
2429
  status_code=response.status_code, response=response, error_map=error_map
2053
2430
  )
@@ -2056,9 +2433,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2056
2433
  deserialized = self._deserialize("object", pipeline_response)
2057
2434
 
2058
2435
  if cls:
2059
- return cls(pipeline_response, deserialized, {})
2436
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2060
2437
 
2061
- return deserialized
2438
+ return deserialized # type: ignore
2062
2439
 
2063
2440
  @distributed_trace_async
2064
2441
  async def set_single_job_properties(
@@ -2078,7 +2455,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2078
2455
  :rtype: any
2079
2456
  :raises ~azure.core.exceptions.HttpResponseError:
2080
2457
  """
2081
- error_map = {
2458
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2082
2459
  401: ClientAuthenticationError,
2083
2460
  404: ResourceNotFoundError,
2084
2461
  409: ResourceExistsError,
@@ -2096,7 +2473,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2096
2473
 
2097
2474
  _json = self._serialize.body(body, "object")
2098
2475
 
2099
- request = build_jobs_set_single_job_properties_request(
2476
+ _request = build_jobs_set_single_job_properties_request(
2100
2477
  job_id=job_id,
2101
2478
  update_timestamp=update_timestamp,
2102
2479
  content_type=content_type,
@@ -2104,18 +2481,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2104
2481
  headers=_headers,
2105
2482
  params=_params,
2106
2483
  )
2107
- request.url = self._client.format_url(request.url)
2484
+ _request.url = self._client.format_url(_request.url)
2108
2485
 
2109
2486
  _stream = False
2110
2487
  pipeline_response: PipelineResponse = (
2111
2488
  await self._client._pipeline.run( # pylint: disable=protected-access
2112
- request, stream=_stream, **kwargs
2489
+ _request, stream=_stream, **kwargs
2113
2490
  )
2114
2491
  )
2115
2492
 
2116
2493
  response = pipeline_response.http_response
2117
2494
 
2118
2495
  if response.status_code not in [200]:
2496
+ if _stream:
2497
+ await response.read() # Load the body in memory and close the socket
2119
2498
  map_error(
2120
2499
  status_code=response.status_code, response=response, error_map=error_map
2121
2500
  )
@@ -2124,9 +2503,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2124
2503
  deserialized = self._deserialize("object", pipeline_response)
2125
2504
 
2126
2505
  if cls:
2127
- return cls(pipeline_response, deserialized, {})
2506
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2128
2507
 
2129
- return deserialized
2508
+ return deserialized # type: ignore
2130
2509
 
2131
2510
  @distributed_trace_async
2132
2511
  async def kill_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2140,7 +2519,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2140
2519
  :rtype: any
2141
2520
  :raises ~azure.core.exceptions.HttpResponseError:
2142
2521
  """
2143
- error_map = {
2522
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2144
2523
  401: ClientAuthenticationError,
2145
2524
  404: ResourceNotFoundError,
2146
2525
  409: ResourceExistsError,
@@ -2153,23 +2532,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2153
2532
 
2154
2533
  cls: ClsType[Any] = kwargs.pop("cls", None)
2155
2534
 
2156
- request = build_jobs_kill_single_job_request(
2535
+ _request = build_jobs_kill_single_job_request(
2157
2536
  job_id=job_id,
2158
2537
  headers=_headers,
2159
2538
  params=_params,
2160
2539
  )
2161
- request.url = self._client.format_url(request.url)
2540
+ _request.url = self._client.format_url(_request.url)
2162
2541
 
2163
2542
  _stream = False
2164
2543
  pipeline_response: PipelineResponse = (
2165
2544
  await self._client._pipeline.run( # pylint: disable=protected-access
2166
- request, stream=_stream, **kwargs
2545
+ _request, stream=_stream, **kwargs
2167
2546
  )
2168
2547
  )
2169
2548
 
2170
2549
  response = pipeline_response.http_response
2171
2550
 
2172
2551
  if response.status_code not in [200]:
2552
+ if _stream:
2553
+ await response.read() # Load the body in memory and close the socket
2173
2554
  map_error(
2174
2555
  status_code=response.status_code, response=response, error_map=error_map
2175
2556
  )
@@ -2178,9 +2559,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2178
2559
  deserialized = self._deserialize("object", pipeline_response)
2179
2560
 
2180
2561
  if cls:
2181
- return cls(pipeline_response, deserialized, {})
2562
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2182
2563
 
2183
- return deserialized
2564
+ return deserialized # type: ignore
2184
2565
 
2185
2566
  @distributed_trace_async
2186
2567
  async def remove_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2198,7 +2579,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2198
2579
  :rtype: any
2199
2580
  :raises ~azure.core.exceptions.HttpResponseError:
2200
2581
  """
2201
- error_map = {
2582
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2202
2583
  401: ClientAuthenticationError,
2203
2584
  404: ResourceNotFoundError,
2204
2585
  409: ResourceExistsError,
@@ -2211,23 +2592,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2211
2592
 
2212
2593
  cls: ClsType[Any] = kwargs.pop("cls", None)
2213
2594
 
2214
- request = build_jobs_remove_single_job_request(
2595
+ _request = build_jobs_remove_single_job_request(
2215
2596
  job_id=job_id,
2216
2597
  headers=_headers,
2217
2598
  params=_params,
2218
2599
  )
2219
- request.url = self._client.format_url(request.url)
2600
+ _request.url = self._client.format_url(_request.url)
2220
2601
 
2221
2602
  _stream = False
2222
2603
  pipeline_response: PipelineResponse = (
2223
2604
  await self._client._pipeline.run( # pylint: disable=protected-access
2224
- request, stream=_stream, **kwargs
2605
+ _request, stream=_stream, **kwargs
2225
2606
  )
2226
2607
  )
2227
2608
 
2228
2609
  response = pipeline_response.http_response
2229
2610
 
2230
2611
  if response.status_code not in [200]:
2612
+ if _stream:
2613
+ await response.read() # Load the body in memory and close the socket
2231
2614
  map_error(
2232
2615
  status_code=response.status_code, response=response, error_map=error_map
2233
2616
  )
@@ -2236,9 +2619,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2236
2619
  deserialized = self._deserialize("object", pipeline_response)
2237
2620
 
2238
2621
  if cls:
2239
- return cls(pipeline_response, deserialized, {})
2622
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2240
2623
 
2241
- return deserialized
2624
+ return deserialized # type: ignore
2242
2625
 
2243
2626
  @distributed_trace_async
2244
2627
  async def get_single_job_status(
@@ -2254,7 +2637,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2254
2637
  :rtype: dict[str, ~client.models.LimitedJobStatusReturn]
2255
2638
  :raises ~azure.core.exceptions.HttpResponseError:
2256
2639
  """
2257
- error_map = {
2640
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2258
2641
  401: ClientAuthenticationError,
2259
2642
  404: ResourceNotFoundError,
2260
2643
  409: ResourceExistsError,
@@ -2269,23 +2652,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2269
2652
  "cls", None
2270
2653
  )
2271
2654
 
2272
- request = build_jobs_get_single_job_status_request(
2655
+ _request = build_jobs_get_single_job_status_request(
2273
2656
  job_id=job_id,
2274
2657
  headers=_headers,
2275
2658
  params=_params,
2276
2659
  )
2277
- request.url = self._client.format_url(request.url)
2660
+ _request.url = self._client.format_url(_request.url)
2278
2661
 
2279
2662
  _stream = False
2280
2663
  pipeline_response: PipelineResponse = (
2281
2664
  await self._client._pipeline.run( # pylint: disable=protected-access
2282
- request, stream=_stream, **kwargs
2665
+ _request, stream=_stream, **kwargs
2283
2666
  )
2284
2667
  )
2285
2668
 
2286
2669
  response = pipeline_response.http_response
2287
2670
 
2288
2671
  if response.status_code not in [200]:
2672
+ if _stream:
2673
+ await response.read() # Load the body in memory and close the socket
2289
2674
  map_error(
2290
2675
  status_code=response.status_code, response=response, error_map=error_map
2291
2676
  )
@@ -2294,9 +2679,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2294
2679
  deserialized = self._deserialize("{LimitedJobStatusReturn}", pipeline_response)
2295
2680
 
2296
2681
  if cls:
2297
- return cls(pipeline_response, deserialized, {})
2682
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2298
2683
 
2299
- return deserialized
2684
+ return deserialized # type: ignore
2300
2685
 
2301
2686
  @overload
2302
2687
  async def set_single_job_status(
@@ -2330,7 +2715,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2330
2715
  async def set_single_job_status(
2331
2716
  self,
2332
2717
  job_id: int,
2333
- body: IO,
2718
+ body: IO[bytes],
2334
2719
  *,
2335
2720
  force: bool = False,
2336
2721
  content_type: str = "application/json",
@@ -2343,7 +2728,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2343
2728
  :param job_id: Required.
2344
2729
  :type job_id: int
2345
2730
  :param body: Required.
2346
- :type body: IO
2731
+ :type body: IO[bytes]
2347
2732
  :keyword force: Default value is False.
2348
2733
  :paramtype force: bool
2349
2734
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -2358,7 +2743,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2358
2743
  async def set_single_job_status(
2359
2744
  self,
2360
2745
  job_id: int,
2361
- body: Union[Dict[str, _models.JobStatusUpdate], IO],
2746
+ body: Union[Dict[str, _models.JobStatusUpdate], IO[bytes]],
2362
2747
  *,
2363
2748
  force: bool = False,
2364
2749
  **kwargs: Any,
@@ -2369,18 +2754,15 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2369
2754
 
2370
2755
  :param job_id: Required.
2371
2756
  :type job_id: int
2372
- :param body: Is either a {str: JobStatusUpdate} type or a IO type. Required.
2373
- :type body: dict[str, ~client.models.JobStatusUpdate] or IO
2757
+ :param body: Is either a {str: JobStatusUpdate} type or a IO[bytes] type. Required.
2758
+ :type body: dict[str, ~client.models.JobStatusUpdate] or IO[bytes]
2374
2759
  :keyword force: Default value is False.
2375
2760
  :paramtype force: bool
2376
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
2377
- Default value is None.
2378
- :paramtype content_type: str
2379
2761
  :return: dict mapping str to SetJobStatusReturn
2380
2762
  :rtype: dict[str, ~client.models.SetJobStatusReturn]
2381
2763
  :raises ~azure.core.exceptions.HttpResponseError:
2382
2764
  """
2383
- error_map = {
2765
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2384
2766
  401: ClientAuthenticationError,
2385
2767
  404: ResourceNotFoundError,
2386
2768
  409: ResourceExistsError,
@@ -2404,7 +2786,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2404
2786
  else:
2405
2787
  _json = self._serialize.body(body, "{JobStatusUpdate}")
2406
2788
 
2407
- request = build_jobs_set_single_job_status_request(
2789
+ _request = build_jobs_set_single_job_status_request(
2408
2790
  job_id=job_id,
2409
2791
  force=force,
2410
2792
  content_type=content_type,
@@ -2413,18 +2795,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2413
2795
  headers=_headers,
2414
2796
  params=_params,
2415
2797
  )
2416
- request.url = self._client.format_url(request.url)
2798
+ _request.url = self._client.format_url(_request.url)
2417
2799
 
2418
2800
  _stream = False
2419
2801
  pipeline_response: PipelineResponse = (
2420
2802
  await self._client._pipeline.run( # pylint: disable=protected-access
2421
- request, stream=_stream, **kwargs
2803
+ _request, stream=_stream, **kwargs
2422
2804
  )
2423
2805
  )
2424
2806
 
2425
2807
  response = pipeline_response.http_response
2426
2808
 
2427
2809
  if response.status_code not in [200]:
2810
+ if _stream:
2811
+ await response.read() # Load the body in memory and close the socket
2428
2812
  map_error(
2429
2813
  status_code=response.status_code, response=response, error_map=error_map
2430
2814
  )
@@ -2433,9 +2817,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2433
2817
  deserialized = self._deserialize("{SetJobStatusReturn}", pipeline_response)
2434
2818
 
2435
2819
  if cls:
2436
- return cls(pipeline_response, deserialized, {})
2820
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2437
2821
 
2438
- return deserialized
2822
+ return deserialized # type: ignore
2439
2823
 
2440
2824
  @distributed_trace_async
2441
2825
  async def get_single_job_status_history(
@@ -2451,7 +2835,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2451
2835
  :rtype: dict[str, list[~client.models.JobStatusReturn]]
2452
2836
  :raises ~azure.core.exceptions.HttpResponseError:
2453
2837
  """
2454
- error_map = {
2838
+ error_map: MutableMapping[int, Type[HttpResponseError]] = {
2455
2839
  401: ClientAuthenticationError,
2456
2840
  404: ResourceNotFoundError,
2457
2841
  409: ResourceExistsError,
@@ -2464,23 +2848,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2464
2848
 
2465
2849
  cls: ClsType[Dict[str, List[_models.JobStatusReturn]]] = kwargs.pop("cls", None)
2466
2850
 
2467
- request = build_jobs_get_single_job_status_history_request(
2851
+ _request = build_jobs_get_single_job_status_history_request(
2468
2852
  job_id=job_id,
2469
2853
  headers=_headers,
2470
2854
  params=_params,
2471
2855
  )
2472
- request.url = self._client.format_url(request.url)
2856
+ _request.url = self._client.format_url(_request.url)
2473
2857
 
2474
2858
  _stream = False
2475
2859
  pipeline_response: PipelineResponse = (
2476
2860
  await self._client._pipeline.run( # pylint: disable=protected-access
2477
- request, stream=_stream, **kwargs
2861
+ _request, stream=_stream, **kwargs
2478
2862
  )
2479
2863
  )
2480
2864
 
2481
2865
  response = pipeline_response.http_response
2482
2866
 
2483
2867
  if response.status_code not in [200]:
2868
+ if _stream:
2869
+ await response.read() # Load the body in memory and close the socket
2484
2870
  map_error(
2485
2871
  status_code=response.status_code, response=response, error_map=error_map
2486
2872
  )
@@ -2489,6 +2875,6 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2489
2875
  deserialized = self._deserialize("{[JobStatusReturn]}", pipeline_response)
2490
2876
 
2491
2877
  if cls:
2492
- return cls(pipeline_response, deserialized, {})
2878
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2493
2879
 
2494
- return deserialized
2880
+ return deserialized # type: ignore