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

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,30 +1,31 @@
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.2)
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
9
  from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload
10
10
 
11
+ from azure.core import MatchConditions
11
12
  from azure.core.exceptions import (
12
13
  ClientAuthenticationError,
13
14
  HttpResponseError,
14
15
  ResourceExistsError,
16
+ ResourceModifiedError,
15
17
  ResourceNotFoundError,
16
18
  ResourceNotModifiedError,
17
19
  map_error,
18
20
  )
19
21
  from azure.core.pipeline import PipelineResponse
20
- from azure.core.pipeline.transport import HttpResponse
21
- from azure.core.rest import HttpRequest
22
+ from azure.core.rest import HttpRequest, HttpResponse
22
23
  from azure.core.tracing.decorator import distributed_trace
23
24
  from azure.core.utils import case_insensitive_dict
24
25
 
25
26
  from .. import models as _models
26
27
  from .._serialization import Serializer
27
- from .._vendor import _format_url_section, raise_if_not_implemented
28
+ from .._vendor import prep_if_match, prep_if_none_match, raise_if_not_implemented
28
29
 
29
30
  if sys.version_info >= (3, 9):
30
31
  from collections.abc import MutableMapping
@@ -93,7 +94,7 @@ def build_auth_do_device_flow_request(*, user_code: str, **kwargs: Any) -> HttpR
93
94
 
94
95
 
95
96
  def build_auth_initiate_device_flow_request(
96
- *, client_id: str, scope: str, audience: str, **kwargs: Any
97
+ *, client_id: str, scope: str, **kwargs: Any
97
98
  ) -> HttpRequest:
98
99
  _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
99
100
  _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
@@ -106,7 +107,6 @@ def build_auth_initiate_device_flow_request(
106
107
  # Construct parameters
107
108
  _params["client_id"] = _SERIALIZER.query("client_id", client_id, "str")
108
109
  _params["scope"] = _SERIALIZER.query("scope", scope, "str")
109
- _params["audience"] = _SERIALIZER.query("audience", audience, "str")
110
110
 
111
111
  # Construct headers
112
112
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -178,7 +178,7 @@ def build_auth_revoke_refresh_token_request(jti: str, **kwargs: Any) -> HttpRequ
178
178
  "jti": _SERIALIZER.url("jti", jti, "str"),
179
179
  }
180
180
 
181
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
181
+ _url: str = _url.format(**path_format_arguments) # type: ignore
182
182
 
183
183
  # Construct headers
184
184
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -186,11 +186,25 @@ def build_auth_revoke_refresh_token_request(jti: str, **kwargs: Any) -> HttpRequ
186
186
  return HttpRequest(method="DELETE", url=_url, headers=_headers, **kwargs)
187
187
 
188
188
 
189
+ def build_auth_userinfo_request(**kwargs: Any) -> HttpRequest:
190
+ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
191
+
192
+ accept = _headers.pop("Accept", "application/json")
193
+
194
+ # Construct URL
195
+ _url = "/api/auth/userinfo"
196
+
197
+ # Construct headers
198
+ _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
199
+
200
+ return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
201
+
202
+
189
203
  def build_auth_authorization_flow_request(
190
204
  *,
191
- response_type: Union[str, _models.Enum3],
205
+ response_type: Union[str, _models.Enum0],
192
206
  code_challenge: str,
193
- code_challenge_method: Union[str, _models.Enum4],
207
+ code_challenge_method: Union[str, _models.Enum1],
194
208
  client_id: str,
195
209
  redirect_uri: str,
196
210
  scope: str,
@@ -249,25 +263,11 @@ def build_auth_authorization_flow_complete_request( # pylint: disable=name-too-
249
263
  )
250
264
 
251
265
 
252
- def build_auth_userinfo_request(**kwargs: Any) -> HttpRequest:
253
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
254
-
255
- accept = _headers.pop("Accept", "application/json")
256
-
257
- # Construct URL
258
- _url = "/api/auth/userinfo"
259
-
260
- # Construct headers
261
- _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
262
-
263
- return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
264
-
265
-
266
266
  def build_config_serve_config_request(
267
- vo: str,
268
267
  *,
269
- if_none_match: Optional[str] = None,
270
268
  if_modified_since: Optional[str] = None,
269
+ etag: Optional[str] = None,
270
+ match_condition: Optional[MatchConditions] = None,
271
271
  **kwargs: Any,
272
272
  ) -> HttpRequest:
273
273
  _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
@@ -275,23 +275,22 @@ def build_config_serve_config_request(
275
275
  accept = _headers.pop("Accept", "application/json")
276
276
 
277
277
  # Construct URL
278
- _url = "/api/config/{vo}"
279
- path_format_arguments = {
280
- "vo": _SERIALIZER.url("vo", vo, "str"),
281
- }
282
-
283
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
278
+ _url = "/api/config/"
284
279
 
285
280
  # Construct headers
286
- if if_none_match is not None:
287
- _headers["if-none-match"] = _SERIALIZER.header(
288
- "if_none_match", if_none_match, "str"
289
- )
290
281
  if if_modified_since is not None:
291
282
  _headers["if-modified-since"] = _SERIALIZER.header(
292
283
  "if_modified_since", if_modified_since, "str"
293
284
  )
294
285
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
286
+ if_match = prep_if_match(etag, match_condition)
287
+ if if_match is not None:
288
+ _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
289
+ if_none_match = prep_if_none_match(etag, match_condition)
290
+ if if_none_match is not None:
291
+ _headers["If-None-Match"] = _SERIALIZER.header(
292
+ "if_none_match", if_none_match, "str"
293
+ )
295
294
 
296
295
  return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
297
296
 
@@ -539,7 +538,7 @@ def build_jobs_reschedule_single_job_request(job_id: int, **kwargs: Any) -> Http
539
538
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
540
539
  }
541
540
 
542
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
541
+ _url: str = _url.format(**path_format_arguments) # type: ignore
543
542
 
544
543
  # Construct headers
545
544
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -611,7 +610,7 @@ def build_jobs_get_single_job_request(job_id: int, **kwargs: Any) -> HttpRequest
611
610
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
612
611
  }
613
612
 
614
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
613
+ _url: str = _url.format(**path_format_arguments) # type: ignore
615
614
 
616
615
  # Construct headers
617
616
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -630,7 +629,7 @@ def build_jobs_delete_single_job_request(job_id: int, **kwargs: Any) -> HttpRequ
630
629
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
631
630
  }
632
631
 
633
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
632
+ _url: str = _url.format(**path_format_arguments) # type: ignore
634
633
 
635
634
  # Construct headers
636
635
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -655,7 +654,7 @@ def build_jobs_set_single_job_properties_request( # pylint: disable=name-too-lo
655
654
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
656
655
  }
657
656
 
658
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
657
+ _url: str = _url.format(**path_format_arguments) # type: ignore
659
658
 
660
659
  # Construct parameters
661
660
  if update_timestamp is not None:
@@ -686,7 +685,7 @@ def build_jobs_kill_single_job_request(job_id: int, **kwargs: Any) -> HttpReques
686
685
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
687
686
  }
688
687
 
689
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
688
+ _url: str = _url.format(**path_format_arguments) # type: ignore
690
689
 
691
690
  # Construct headers
692
691
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -705,7 +704,7 @@ def build_jobs_remove_single_job_request(job_id: int, **kwargs: Any) -> HttpRequ
705
704
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
706
705
  }
707
706
 
708
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
707
+ _url: str = _url.format(**path_format_arguments) # type: ignore
709
708
 
710
709
  # Construct headers
711
710
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -724,7 +723,7 @@ def build_jobs_get_single_job_status_request(job_id: int, **kwargs: Any) -> Http
724
723
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
725
724
  }
726
725
 
727
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
726
+ _url: str = _url.format(**path_format_arguments) # type: ignore
728
727
 
729
728
  # Construct headers
730
729
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -749,7 +748,7 @@ def build_jobs_set_single_job_status_request(
749
748
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
750
749
  }
751
750
 
752
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
751
+ _url: str = _url.format(**path_format_arguments) # type: ignore
753
752
 
754
753
  # Construct parameters
755
754
  if force is not None:
@@ -780,7 +779,7 @@ def build_jobs_get_single_job_status_history_request( # pylint: disable=name-to
780
779
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
781
780
  }
782
781
 
783
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
782
+ _url: str = _url.format(**path_format_arguments) # type: ignore
784
783
 
785
784
  # Construct headers
786
785
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -832,22 +831,24 @@ class WellKnownOperations:
832
831
 
833
832
  cls: ClsType[Any] = kwargs.pop("cls", None)
834
833
 
835
- request = build_well_known_openid_configuration_request(
834
+ _request = build_well_known_openid_configuration_request(
836
835
  headers=_headers,
837
836
  params=_params,
838
837
  )
839
- request.url = self._client.format_url(request.url)
838
+ _request.url = self._client.format_url(_request.url)
840
839
 
841
840
  _stream = False
842
841
  pipeline_response: PipelineResponse = (
843
842
  self._client._pipeline.run( # pylint: disable=protected-access
844
- request, stream=_stream, **kwargs
843
+ _request, stream=_stream, **kwargs
845
844
  )
846
845
  )
847
846
 
848
847
  response = pipeline_response.http_response
849
848
 
850
849
  if response.status_code not in [200]:
850
+ if _stream:
851
+ response.read() # Load the body in memory and close the socket
851
852
  map_error(
852
853
  status_code=response.status_code, response=response, error_map=error_map
853
854
  )
@@ -856,9 +857,9 @@ class WellKnownOperations:
856
857
  deserialized = self._deserialize("object", pipeline_response)
857
858
 
858
859
  if cls:
859
- return cls(pipeline_response, deserialized, {})
860
+ return cls(pipeline_response, deserialized, {}) # type: ignore
860
861
 
861
- return deserialized
862
+ return deserialized # type: ignore
862
863
 
863
864
  @distributed_trace
864
865
  def installation_metadata(self, **kwargs: Any) -> _models.Metadata:
@@ -883,22 +884,24 @@ class WellKnownOperations:
883
884
 
884
885
  cls: ClsType[_models.Metadata] = kwargs.pop("cls", None)
885
886
 
886
- request = build_well_known_installation_metadata_request(
887
+ _request = build_well_known_installation_metadata_request(
887
888
  headers=_headers,
888
889
  params=_params,
889
890
  )
890
- request.url = self._client.format_url(request.url)
891
+ _request.url = self._client.format_url(_request.url)
891
892
 
892
893
  _stream = False
893
894
  pipeline_response: PipelineResponse = (
894
895
  self._client._pipeline.run( # pylint: disable=protected-access
895
- request, stream=_stream, **kwargs
896
+ _request, stream=_stream, **kwargs
896
897
  )
897
898
  )
898
899
 
899
900
  response = pipeline_response.http_response
900
901
 
901
902
  if response.status_code not in [200]:
903
+ if _stream:
904
+ response.read() # Load the body in memory and close the socket
902
905
  map_error(
903
906
  status_code=response.status_code, response=response, error_map=error_map
904
907
  )
@@ -907,12 +910,12 @@ class WellKnownOperations:
907
910
  deserialized = self._deserialize("Metadata", pipeline_response)
908
911
 
909
912
  if cls:
910
- return cls(pipeline_response, deserialized, {})
913
+ return cls(pipeline_response, deserialized, {}) # type: ignore
911
914
 
912
- return deserialized
915
+ return deserialized # type: ignore
913
916
 
914
917
 
915
- class AuthOperations:
918
+ class AuthOperations: # pylint: disable=abstract-class-instantiated
916
919
  """
917
920
  .. warning::
918
921
  **DO NOT** instantiate this class directly.
@@ -932,6 +935,7 @@ class AuthOperations:
932
935
  self._deserialize = (
933
936
  input_args.pop(0) if input_args else kwargs.pop("deserializer")
934
937
  )
938
+
935
939
  raise_if_not_implemented(
936
940
  self.__class__,
937
941
  [
@@ -971,23 +975,25 @@ class AuthOperations:
971
975
 
972
976
  cls: ClsType[Any] = kwargs.pop("cls", None)
973
977
 
974
- request = build_auth_do_device_flow_request(
978
+ _request = build_auth_do_device_flow_request(
975
979
  user_code=user_code,
976
980
  headers=_headers,
977
981
  params=_params,
978
982
  )
979
- request.url = self._client.format_url(request.url)
983
+ _request.url = self._client.format_url(_request.url)
980
984
 
981
985
  _stream = False
982
986
  pipeline_response: PipelineResponse = (
983
987
  self._client._pipeline.run( # pylint: disable=protected-access
984
- request, stream=_stream, **kwargs
988
+ _request, stream=_stream, **kwargs
985
989
  )
986
990
  )
987
991
 
988
992
  response = pipeline_response.http_response
989
993
 
990
994
  if response.status_code not in [200]:
995
+ if _stream:
996
+ response.read() # Load the body in memory and close the socket
991
997
  map_error(
992
998
  status_code=response.status_code, response=response, error_map=error_map
993
999
  )
@@ -996,13 +1002,13 @@ class AuthOperations:
996
1002
  deserialized = self._deserialize("object", pipeline_response)
997
1003
 
998
1004
  if cls:
999
- return cls(pipeline_response, deserialized, {})
1005
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1000
1006
 
1001
- return deserialized
1007
+ return deserialized # type: ignore
1002
1008
 
1003
1009
  @distributed_trace
1004
1010
  def initiate_device_flow(
1005
- self, *, client_id: str, scope: str, audience: str, **kwargs: Any
1011
+ self, *, client_id: str, scope: str, **kwargs: Any
1006
1012
  ) -> _models.InitiateDeviceFlowResponse:
1007
1013
  """Initiate Device Flow.
1008
1014
 
@@ -1018,8 +1024,6 @@ class AuthOperations:
1018
1024
  :paramtype client_id: str
1019
1025
  :keyword scope: Required.
1020
1026
  :paramtype scope: str
1021
- :keyword audience: Required.
1022
- :paramtype audience: str
1023
1027
  :return: InitiateDeviceFlowResponse
1024
1028
  :rtype: ~client.models.InitiateDeviceFlowResponse
1025
1029
  :raises ~azure.core.exceptions.HttpResponseError:
@@ -1037,25 +1041,26 @@ class AuthOperations:
1037
1041
 
1038
1042
  cls: ClsType[_models.InitiateDeviceFlowResponse] = kwargs.pop("cls", None)
1039
1043
 
1040
- request = build_auth_initiate_device_flow_request(
1044
+ _request = build_auth_initiate_device_flow_request(
1041
1045
  client_id=client_id,
1042
1046
  scope=scope,
1043
- audience=audience,
1044
1047
  headers=_headers,
1045
1048
  params=_params,
1046
1049
  )
1047
- request.url = self._client.format_url(request.url)
1050
+ _request.url = self._client.format_url(_request.url)
1048
1051
 
1049
1052
  _stream = False
1050
1053
  pipeline_response: PipelineResponse = (
1051
1054
  self._client._pipeline.run( # pylint: disable=protected-access
1052
- request, stream=_stream, **kwargs
1055
+ _request, stream=_stream, **kwargs
1053
1056
  )
1054
1057
  )
1055
1058
 
1056
1059
  response = pipeline_response.http_response
1057
1060
 
1058
1061
  if response.status_code not in [200]:
1062
+ if _stream:
1063
+ response.read() # Load the body in memory and close the socket
1059
1064
  map_error(
1060
1065
  status_code=response.status_code, response=response, error_map=error_map
1061
1066
  )
@@ -1066,9 +1071,9 @@ class AuthOperations:
1066
1071
  )
1067
1072
 
1068
1073
  if cls:
1069
- return cls(pipeline_response, deserialized, {})
1074
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1070
1075
 
1071
- return deserialized
1076
+ return deserialized # type: ignore
1072
1077
 
1073
1078
  @distributed_trace
1074
1079
  def finish_device_flow(self, *, code: str, state: str, **kwargs: Any) -> Any:
@@ -1101,24 +1106,26 @@ class AuthOperations:
1101
1106
 
1102
1107
  cls: ClsType[Any] = kwargs.pop("cls", None)
1103
1108
 
1104
- request = build_auth_finish_device_flow_request(
1109
+ _request = build_auth_finish_device_flow_request(
1105
1110
  code=code,
1106
1111
  state=state,
1107
1112
  headers=_headers,
1108
1113
  params=_params,
1109
1114
  )
1110
- request.url = self._client.format_url(request.url)
1115
+ _request.url = self._client.format_url(_request.url)
1111
1116
 
1112
1117
  _stream = False
1113
1118
  pipeline_response: PipelineResponse = (
1114
1119
  self._client._pipeline.run( # pylint: disable=protected-access
1115
- request, stream=_stream, **kwargs
1120
+ _request, stream=_stream, **kwargs
1116
1121
  )
1117
1122
  )
1118
1123
 
1119
1124
  response = pipeline_response.http_response
1120
1125
 
1121
1126
  if response.status_code not in [200]:
1127
+ if _stream:
1128
+ response.read() # Load the body in memory and close the socket
1122
1129
  map_error(
1123
1130
  status_code=response.status_code, response=response, error_map=error_map
1124
1131
  )
@@ -1127,9 +1134,9 @@ class AuthOperations:
1127
1134
  deserialized = self._deserialize("object", pipeline_response)
1128
1135
 
1129
1136
  if cls:
1130
- return cls(pipeline_response, deserialized, {})
1137
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1131
1138
 
1132
- return deserialized
1139
+ return deserialized # type: ignore
1133
1140
 
1134
1141
  @distributed_trace
1135
1142
  def finished(self, **kwargs: Any) -> Any:
@@ -1154,22 +1161,24 @@ class AuthOperations:
1154
1161
 
1155
1162
  cls: ClsType[Any] = kwargs.pop("cls", None)
1156
1163
 
1157
- request = build_auth_finished_request(
1164
+ _request = build_auth_finished_request(
1158
1165
  headers=_headers,
1159
1166
  params=_params,
1160
1167
  )
1161
- request.url = self._client.format_url(request.url)
1168
+ _request.url = self._client.format_url(_request.url)
1162
1169
 
1163
1170
  _stream = False
1164
1171
  pipeline_response: PipelineResponse = (
1165
1172
  self._client._pipeline.run( # pylint: disable=protected-access
1166
- request, stream=_stream, **kwargs
1173
+ _request, stream=_stream, **kwargs
1167
1174
  )
1168
1175
  )
1169
1176
 
1170
1177
  response = pipeline_response.http_response
1171
1178
 
1172
1179
  if response.status_code not in [200]:
1180
+ if _stream:
1181
+ response.read() # Load the body in memory and close the socket
1173
1182
  map_error(
1174
1183
  status_code=response.status_code, response=response, error_map=error_map
1175
1184
  )
@@ -1178,15 +1187,16 @@ class AuthOperations:
1178
1187
  deserialized = self._deserialize("object", pipeline_response)
1179
1188
 
1180
1189
  if cls:
1181
- return cls(pipeline_response, deserialized, {})
1190
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1182
1191
 
1183
- return deserialized
1192
+ return deserialized # type: ignore
1184
1193
 
1185
1194
  @distributed_trace
1186
1195
  def get_refresh_tokens(self, **kwargs: Any) -> List[Any]:
1187
1196
  """Get Refresh Tokens.
1188
1197
 
1189
- Get Refresh Tokens.
1198
+ Get all refresh tokens for the user. If the user has the ``proxy_management`` property, then
1199
+ the subject is not used to filter the refresh tokens.
1190
1200
 
1191
1201
  :return: list of any
1192
1202
  :rtype: list[any]
@@ -1205,22 +1215,24 @@ class AuthOperations:
1205
1215
 
1206
1216
  cls: ClsType[List[Any]] = kwargs.pop("cls", None)
1207
1217
 
1208
- request = build_auth_get_refresh_tokens_request(
1218
+ _request = build_auth_get_refresh_tokens_request(
1209
1219
  headers=_headers,
1210
1220
  params=_params,
1211
1221
  )
1212
- request.url = self._client.format_url(request.url)
1222
+ _request.url = self._client.format_url(_request.url)
1213
1223
 
1214
1224
  _stream = False
1215
1225
  pipeline_response: PipelineResponse = (
1216
1226
  self._client._pipeline.run( # pylint: disable=protected-access
1217
- request, stream=_stream, **kwargs
1227
+ _request, stream=_stream, **kwargs
1218
1228
  )
1219
1229
  )
1220
1230
 
1221
1231
  response = pipeline_response.http_response
1222
1232
 
1223
1233
  if response.status_code not in [200]:
1234
+ if _stream:
1235
+ response.read() # Load the body in memory and close the socket
1224
1236
  map_error(
1225
1237
  status_code=response.status_code, response=response, error_map=error_map
1226
1238
  )
@@ -1229,15 +1241,16 @@ class AuthOperations:
1229
1241
  deserialized = self._deserialize("[object]", pipeline_response)
1230
1242
 
1231
1243
  if cls:
1232
- return cls(pipeline_response, deserialized, {})
1244
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1233
1245
 
1234
- return deserialized
1246
+ return deserialized # type: ignore
1235
1247
 
1236
1248
  @distributed_trace
1237
1249
  def revoke_refresh_token(self, jti: str, **kwargs: Any) -> str:
1238
1250
  """Revoke Refresh Token.
1239
1251
 
1240
- Revoke Refresh Token.
1252
+ Revoke a refresh token. If the user has the ``proxy_management`` property, then
1253
+ the subject is not used to filter the refresh tokens.
1241
1254
 
1242
1255
  :param jti: Required.
1243
1256
  :type jti: str
@@ -1258,23 +1271,25 @@ class AuthOperations:
1258
1271
 
1259
1272
  cls: ClsType[str] = kwargs.pop("cls", None)
1260
1273
 
1261
- request = build_auth_revoke_refresh_token_request(
1274
+ _request = build_auth_revoke_refresh_token_request(
1262
1275
  jti=jti,
1263
1276
  headers=_headers,
1264
1277
  params=_params,
1265
1278
  )
1266
- request.url = self._client.format_url(request.url)
1279
+ _request.url = self._client.format_url(_request.url)
1267
1280
 
1268
1281
  _stream = False
1269
1282
  pipeline_response: PipelineResponse = (
1270
1283
  self._client._pipeline.run( # pylint: disable=protected-access
1271
- request, stream=_stream, **kwargs
1284
+ _request, stream=_stream, **kwargs
1272
1285
  )
1273
1286
  )
1274
1287
 
1275
1288
  response = pipeline_response.http_response
1276
1289
 
1277
1290
  if response.status_code not in [200]:
1291
+ if _stream:
1292
+ response.read() # Load the body in memory and close the socket
1278
1293
  map_error(
1279
1294
  status_code=response.status_code, response=response, error_map=error_map
1280
1295
  )
@@ -1283,17 +1298,70 @@ class AuthOperations:
1283
1298
  deserialized = self._deserialize("str", pipeline_response)
1284
1299
 
1285
1300
  if cls:
1286
- return cls(pipeline_response, deserialized, {})
1301
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1302
+
1303
+ return deserialized # type: ignore
1304
+
1305
+ @distributed_trace
1306
+ def userinfo(self, **kwargs: Any) -> _models.UserInfoResponse:
1307
+ """Userinfo.
1308
+
1309
+ Get information about the user's identity.
1310
+
1311
+ :return: UserInfoResponse
1312
+ :rtype: ~client.models.UserInfoResponse
1313
+ :raises ~azure.core.exceptions.HttpResponseError:
1314
+ """
1315
+ error_map = {
1316
+ 401: ClientAuthenticationError,
1317
+ 404: ResourceNotFoundError,
1318
+ 409: ResourceExistsError,
1319
+ 304: ResourceNotModifiedError,
1320
+ }
1321
+ error_map.update(kwargs.pop("error_map", {}) or {})
1322
+
1323
+ _headers = kwargs.pop("headers", {}) or {}
1324
+ _params = kwargs.pop("params", {}) or {}
1325
+
1326
+ cls: ClsType[_models.UserInfoResponse] = kwargs.pop("cls", None)
1327
+
1328
+ _request = build_auth_userinfo_request(
1329
+ headers=_headers,
1330
+ params=_params,
1331
+ )
1332
+ _request.url = self._client.format_url(_request.url)
1333
+
1334
+ _stream = False
1335
+ pipeline_response: PipelineResponse = (
1336
+ self._client._pipeline.run( # pylint: disable=protected-access
1337
+ _request, stream=_stream, **kwargs
1338
+ )
1339
+ )
1340
+
1341
+ response = pipeline_response.http_response
1342
+
1343
+ if response.status_code not in [200]:
1344
+ if _stream:
1345
+ response.read() # Load the body in memory and close the socket
1346
+ map_error(
1347
+ status_code=response.status_code, response=response, error_map=error_map
1348
+ )
1349
+ raise HttpResponseError(response=response)
1350
+
1351
+ deserialized = self._deserialize("UserInfoResponse", pipeline_response)
1352
+
1353
+ if cls:
1354
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1287
1355
 
1288
- return deserialized
1356
+ return deserialized # type: ignore
1289
1357
 
1290
1358
  @distributed_trace
1291
1359
  def authorization_flow(
1292
1360
  self,
1293
1361
  *,
1294
- response_type: Union[str, _models.Enum3],
1362
+ response_type: Union[str, _models.Enum0],
1295
1363
  code_challenge: str,
1296
- code_challenge_method: Union[str, _models.Enum4],
1364
+ code_challenge_method: Union[str, _models.Enum1],
1297
1365
  client_id: str,
1298
1366
  redirect_uri: str,
1299
1367
  scope: str,
@@ -1305,11 +1373,11 @@ class AuthOperations:
1305
1373
  Authorization Flow.
1306
1374
 
1307
1375
  :keyword response_type: "code" Required.
1308
- :paramtype response_type: str or ~client.models.Enum3
1376
+ :paramtype response_type: str or ~client.models.Enum0
1309
1377
  :keyword code_challenge: Required.
1310
1378
  :paramtype code_challenge: str
1311
1379
  :keyword code_challenge_method: "S256" Required.
1312
- :paramtype code_challenge_method: str or ~client.models.Enum4
1380
+ :paramtype code_challenge_method: str or ~client.models.Enum1
1313
1381
  :keyword client_id: Required.
1314
1382
  :paramtype client_id: str
1315
1383
  :keyword redirect_uri: Required.
@@ -1335,7 +1403,7 @@ class AuthOperations:
1335
1403
 
1336
1404
  cls: ClsType[Any] = kwargs.pop("cls", None)
1337
1405
 
1338
- request = build_auth_authorization_flow_request(
1406
+ _request = build_auth_authorization_flow_request(
1339
1407
  response_type=response_type,
1340
1408
  code_challenge=code_challenge,
1341
1409
  code_challenge_method=code_challenge_method,
@@ -1346,18 +1414,20 @@ class AuthOperations:
1346
1414
  headers=_headers,
1347
1415
  params=_params,
1348
1416
  )
1349
- request.url = self._client.format_url(request.url)
1417
+ _request.url = self._client.format_url(_request.url)
1350
1418
 
1351
1419
  _stream = False
1352
1420
  pipeline_response: PipelineResponse = (
1353
1421
  self._client._pipeline.run( # pylint: disable=protected-access
1354
- request, stream=_stream, **kwargs
1422
+ _request, stream=_stream, **kwargs
1355
1423
  )
1356
1424
  )
1357
1425
 
1358
1426
  response = pipeline_response.http_response
1359
1427
 
1360
1428
  if response.status_code not in [200]:
1429
+ if _stream:
1430
+ response.read() # Load the body in memory and close the socket
1361
1431
  map_error(
1362
1432
  status_code=response.status_code, response=response, error_map=error_map
1363
1433
  )
@@ -1366,9 +1436,9 @@ class AuthOperations:
1366
1436
  deserialized = self._deserialize("object", pipeline_response)
1367
1437
 
1368
1438
  if cls:
1369
- return cls(pipeline_response, deserialized, {})
1439
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1370
1440
 
1371
- return deserialized
1441
+ return deserialized # type: ignore
1372
1442
 
1373
1443
  @distributed_trace
1374
1444
  def authorization_flow_complete(
@@ -1399,24 +1469,26 @@ class AuthOperations:
1399
1469
 
1400
1470
  cls: ClsType[Any] = kwargs.pop("cls", None)
1401
1471
 
1402
- request = build_auth_authorization_flow_complete_request(
1472
+ _request = build_auth_authorization_flow_complete_request(
1403
1473
  code=code,
1404
1474
  state=state,
1405
1475
  headers=_headers,
1406
1476
  params=_params,
1407
1477
  )
1408
- request.url = self._client.format_url(request.url)
1478
+ _request.url = self._client.format_url(_request.url)
1409
1479
 
1410
1480
  _stream = False
1411
1481
  pipeline_response: PipelineResponse = (
1412
1482
  self._client._pipeline.run( # pylint: disable=protected-access
1413
- request, stream=_stream, **kwargs
1483
+ _request, stream=_stream, **kwargs
1414
1484
  )
1415
1485
  )
1416
1486
 
1417
1487
  response = pipeline_response.http_response
1418
1488
 
1419
1489
  if response.status_code not in [200]:
1490
+ if _stream:
1491
+ response.read() # Load the body in memory and close the socket
1420
1492
  map_error(
1421
1493
  status_code=response.status_code, response=response, error_map=error_map
1422
1494
  )
@@ -1425,60 +1497,9 @@ class AuthOperations:
1425
1497
  deserialized = self._deserialize("object", pipeline_response)
1426
1498
 
1427
1499
  if cls:
1428
- return cls(pipeline_response, deserialized, {})
1429
-
1430
- return deserialized
1431
-
1432
- @distributed_trace
1433
- def userinfo(self, **kwargs: Any) -> _models.UserInfoResponse:
1434
- """Userinfo.
1435
-
1436
- Userinfo.
1437
-
1438
- :return: UserInfoResponse
1439
- :rtype: ~client.models.UserInfoResponse
1440
- :raises ~azure.core.exceptions.HttpResponseError:
1441
- """
1442
- error_map = {
1443
- 401: ClientAuthenticationError,
1444
- 404: ResourceNotFoundError,
1445
- 409: ResourceExistsError,
1446
- 304: ResourceNotModifiedError,
1447
- }
1448
- error_map.update(kwargs.pop("error_map", {}) or {})
1449
-
1450
- _headers = kwargs.pop("headers", {}) or {}
1451
- _params = kwargs.pop("params", {}) or {}
1452
-
1453
- cls: ClsType[_models.UserInfoResponse] = kwargs.pop("cls", None)
1454
-
1455
- request = build_auth_userinfo_request(
1456
- headers=_headers,
1457
- params=_params,
1458
- )
1459
- request.url = self._client.format_url(request.url)
1460
-
1461
- _stream = False
1462
- pipeline_response: PipelineResponse = (
1463
- self._client._pipeline.run( # pylint: disable=protected-access
1464
- request, stream=_stream, **kwargs
1465
- )
1466
- )
1467
-
1468
- response = pipeline_response.http_response
1469
-
1470
- if response.status_code not in [200]:
1471
- map_error(
1472
- status_code=response.status_code, response=response, error_map=error_map
1473
- )
1474
- raise HttpResponseError(response=response)
1475
-
1476
- deserialized = self._deserialize("UserInfoResponse", pipeline_response)
1477
-
1478
- if cls:
1479
- return cls(pipeline_response, deserialized, {})
1500
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1480
1501
 
1481
- return deserialized
1502
+ return deserialized # type: ignore
1482
1503
 
1483
1504
 
1484
1505
  class ConfigOperations:
@@ -1505,15 +1526,14 @@ class ConfigOperations:
1505
1526
  @distributed_trace
1506
1527
  def serve_config(
1507
1528
  self,
1508
- vo: str,
1509
1529
  *,
1510
- if_none_match: Optional[str] = None,
1511
1530
  if_modified_since: Optional[str] = None,
1531
+ etag: Optional[str] = None,
1532
+ match_condition: Optional[MatchConditions] = None,
1512
1533
  **kwargs: Any,
1513
1534
  ) -> Any:
1514
1535
  """Serve Config.
1515
1536
 
1516
- "
1517
1537
  Get the latest view of the config.
1518
1538
 
1519
1539
  If If-None-Match header is given and matches the latest ETag, return 304
@@ -1521,12 +1541,13 @@ class ConfigOperations:
1521
1541
  If If-Modified-Since is given and is newer than latest,
1522
1542
  return 304: this is to avoid flip/flopping.
1523
1543
 
1524
- :param vo: Required.
1525
- :type vo: str
1526
- :keyword if_none_match: Default value is None.
1527
- :paramtype if_none_match: str
1528
1544
  :keyword if_modified_since: Default value is None.
1529
1545
  :paramtype if_modified_since: str
1546
+ :keyword etag: check if resource is changed. Set None to skip checking etag. Default value is
1547
+ None.
1548
+ :paramtype etag: str
1549
+ :keyword match_condition: The match condition to use upon the etag. Default value is None.
1550
+ :paramtype match_condition: ~azure.core.MatchConditions
1530
1551
  :return: any
1531
1552
  :rtype: any
1532
1553
  :raises ~azure.core.exceptions.HttpResponseError:
@@ -1537,6 +1558,12 @@ class ConfigOperations:
1537
1558
  409: ResourceExistsError,
1538
1559
  304: ResourceNotModifiedError,
1539
1560
  }
1561
+ if match_condition == MatchConditions.IfNotModified:
1562
+ error_map[412] = ResourceModifiedError
1563
+ elif match_condition == MatchConditions.IfPresent:
1564
+ error_map[412] = ResourceNotFoundError
1565
+ elif match_condition == MatchConditions.IfMissing:
1566
+ error_map[412] = ResourceExistsError
1540
1567
  error_map.update(kwargs.pop("error_map", {}) or {})
1541
1568
 
1542
1569
  _headers = kwargs.pop("headers", {}) or {}
@@ -1544,25 +1571,27 @@ class ConfigOperations:
1544
1571
 
1545
1572
  cls: ClsType[Any] = kwargs.pop("cls", None)
1546
1573
 
1547
- request = build_config_serve_config_request(
1548
- vo=vo,
1549
- if_none_match=if_none_match,
1574
+ _request = build_config_serve_config_request(
1550
1575
  if_modified_since=if_modified_since,
1576
+ etag=etag,
1577
+ match_condition=match_condition,
1551
1578
  headers=_headers,
1552
1579
  params=_params,
1553
1580
  )
1554
- request.url = self._client.format_url(request.url)
1581
+ _request.url = self._client.format_url(_request.url)
1555
1582
 
1556
1583
  _stream = False
1557
1584
  pipeline_response: PipelineResponse = (
1558
1585
  self._client._pipeline.run( # pylint: disable=protected-access
1559
- request, stream=_stream, **kwargs
1586
+ _request, stream=_stream, **kwargs
1560
1587
  )
1561
1588
  )
1562
1589
 
1563
1590
  response = pipeline_response.http_response
1564
1591
 
1565
1592
  if response.status_code not in [200]:
1593
+ if _stream:
1594
+ response.read() # Load the body in memory and close the socket
1566
1595
  map_error(
1567
1596
  status_code=response.status_code, response=response, error_map=error_map
1568
1597
  )
@@ -1571,9 +1600,9 @@ class ConfigOperations:
1571
1600
  deserialized = self._deserialize("object", pipeline_response)
1572
1601
 
1573
1602
  if cls:
1574
- return cls(pipeline_response, deserialized, {})
1603
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1575
1604
 
1576
- return deserialized
1605
+ return deserialized # type: ignore
1577
1606
 
1578
1607
 
1579
1608
  class JobsOperations: # pylint: disable=too-many-public-methods
@@ -1630,23 +1659,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1630
1659
 
1631
1660
  cls: ClsType[_models.SandboxDownloadResponse] = kwargs.pop("cls", None)
1632
1661
 
1633
- request = build_jobs_get_sandbox_file_request(
1662
+ _request = build_jobs_get_sandbox_file_request(
1634
1663
  pfn=pfn,
1635
1664
  headers=_headers,
1636
1665
  params=_params,
1637
1666
  )
1638
- request.url = self._client.format_url(request.url)
1667
+ _request.url = self._client.format_url(_request.url)
1639
1668
 
1640
1669
  _stream = False
1641
1670
  pipeline_response: PipelineResponse = (
1642
1671
  self._client._pipeline.run( # pylint: disable=protected-access
1643
- request, stream=_stream, **kwargs
1672
+ _request, stream=_stream, **kwargs
1644
1673
  )
1645
1674
  )
1646
1675
 
1647
1676
  response = pipeline_response.http_response
1648
1677
 
1649
1678
  if response.status_code not in [200]:
1679
+ if _stream:
1680
+ response.read() # Load the body in memory and close the socket
1650
1681
  map_error(
1651
1682
  status_code=response.status_code, response=response, error_map=error_map
1652
1683
  )
@@ -1655,9 +1686,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1655
1686
  deserialized = self._deserialize("SandboxDownloadResponse", pipeline_response)
1656
1687
 
1657
1688
  if cls:
1658
- return cls(pipeline_response, deserialized, {})
1689
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1659
1690
 
1660
- return deserialized
1691
+ return deserialized # type: ignore
1661
1692
 
1662
1693
  @overload
1663
1694
  def initiate_sandbox_upload(
@@ -1689,7 +1720,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1689
1720
 
1690
1721
  @overload
1691
1722
  def initiate_sandbox_upload(
1692
- self, body: IO, *, content_type: str = "application/json", **kwargs: Any
1723
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
1693
1724
  ) -> _models.SandboxUploadResponse:
1694
1725
  """Initiate Sandbox Upload.
1695
1726
 
@@ -1702,7 +1733,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1702
1733
  should be used to upload the sandbox to the storage backend.
1703
1734
 
1704
1735
  :param body: Required.
1705
- :type body: IO
1736
+ :type body: IO[bytes]
1706
1737
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1707
1738
  Default value is "application/json".
1708
1739
  :paramtype content_type: str
@@ -1713,7 +1744,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1713
1744
 
1714
1745
  @distributed_trace
1715
1746
  def initiate_sandbox_upload(
1716
- self, body: Union[_models.SandboxInfo, IO], **kwargs: Any
1747
+ self, body: Union[_models.SandboxInfo, IO[bytes]], **kwargs: Any
1717
1748
  ) -> _models.SandboxUploadResponse:
1718
1749
  """Initiate Sandbox Upload.
1719
1750
 
@@ -1725,11 +1756,8 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1725
1756
  If the sandbox does not exist in the database then the "url" and "fields"
1726
1757
  should be used to upload the sandbox to the storage backend.
1727
1758
 
1728
- :param body: Is either a SandboxInfo type or a IO type. Required.
1729
- :type body: ~client.models.SandboxInfo or IO
1730
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
1731
- Default value is None.
1732
- :paramtype content_type: str
1759
+ :param body: Is either a SandboxInfo type or a IO[bytes] type. Required.
1760
+ :type body: ~client.models.SandboxInfo or IO[bytes]
1733
1761
  :return: SandboxUploadResponse
1734
1762
  :rtype: ~client.models.SandboxUploadResponse
1735
1763
  :raises ~azure.core.exceptions.HttpResponseError:
@@ -1758,25 +1786,27 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1758
1786
  else:
1759
1787
  _json = self._serialize.body(body, "SandboxInfo")
1760
1788
 
1761
- request = build_jobs_initiate_sandbox_upload_request(
1789
+ _request = build_jobs_initiate_sandbox_upload_request(
1762
1790
  content_type=content_type,
1763
1791
  json=_json,
1764
1792
  content=_content,
1765
1793
  headers=_headers,
1766
1794
  params=_params,
1767
1795
  )
1768
- request.url = self._client.format_url(request.url)
1796
+ _request.url = self._client.format_url(_request.url)
1769
1797
 
1770
1798
  _stream = False
1771
1799
  pipeline_response: PipelineResponse = (
1772
1800
  self._client._pipeline.run( # pylint: disable=protected-access
1773
- request, stream=_stream, **kwargs
1801
+ _request, stream=_stream, **kwargs
1774
1802
  )
1775
1803
  )
1776
1804
 
1777
1805
  response = pipeline_response.http_response
1778
1806
 
1779
1807
  if response.status_code not in [200]:
1808
+ if _stream:
1809
+ response.read() # Load the body in memory and close the socket
1780
1810
  map_error(
1781
1811
  status_code=response.status_code, response=response, error_map=error_map
1782
1812
  )
@@ -1785,9 +1815,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1785
1815
  deserialized = self._deserialize("SandboxUploadResponse", pipeline_response)
1786
1816
 
1787
1817
  if cls:
1788
- return cls(pipeline_response, deserialized, {})
1818
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1789
1819
 
1790
- return deserialized
1820
+ return deserialized # type: ignore
1791
1821
 
1792
1822
  @overload
1793
1823
  def submit_bulk_jobs(
@@ -1809,14 +1839,14 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1809
1839
 
1810
1840
  @overload
1811
1841
  def submit_bulk_jobs(
1812
- self, body: IO, *, content_type: str = "application/json", **kwargs: Any
1842
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
1813
1843
  ) -> List[_models.InsertedJob]:
1814
1844
  """Submit Bulk Jobs.
1815
1845
 
1816
1846
  Submit Bulk Jobs.
1817
1847
 
1818
1848
  :param body: Required.
1819
- :type body: IO
1849
+ :type body: IO[bytes]
1820
1850
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1821
1851
  Default value is "application/json".
1822
1852
  :paramtype content_type: str
@@ -1827,17 +1857,14 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1827
1857
 
1828
1858
  @distributed_trace
1829
1859
  def submit_bulk_jobs(
1830
- self, body: Union[List[str], IO], **kwargs: Any
1860
+ self, body: Union[List[str], IO[bytes]], **kwargs: Any
1831
1861
  ) -> List[_models.InsertedJob]:
1832
1862
  """Submit Bulk Jobs.
1833
1863
 
1834
1864
  Submit Bulk Jobs.
1835
1865
 
1836
- :param body: Is either a [str] type or a IO type. Required.
1837
- :type body: list[str] or IO
1838
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
1839
- Default value is None.
1840
- :paramtype content_type: str
1866
+ :param body: Is either a [str] type or a IO[bytes] type. Required.
1867
+ :type body: list[str] or IO[bytes]
1841
1868
  :return: list of InsertedJob
1842
1869
  :rtype: list[~client.models.InsertedJob]
1843
1870
  :raises ~azure.core.exceptions.HttpResponseError:
@@ -1866,25 +1893,27 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1866
1893
  else:
1867
1894
  _json = self._serialize.body(body, "[str]")
1868
1895
 
1869
- request = build_jobs_submit_bulk_jobs_request(
1896
+ _request = build_jobs_submit_bulk_jobs_request(
1870
1897
  content_type=content_type,
1871
1898
  json=_json,
1872
1899
  content=_content,
1873
1900
  headers=_headers,
1874
1901
  params=_params,
1875
1902
  )
1876
- request.url = self._client.format_url(request.url)
1903
+ _request.url = self._client.format_url(_request.url)
1877
1904
 
1878
1905
  _stream = False
1879
1906
  pipeline_response: PipelineResponse = (
1880
1907
  self._client._pipeline.run( # pylint: disable=protected-access
1881
- request, stream=_stream, **kwargs
1908
+ _request, stream=_stream, **kwargs
1882
1909
  )
1883
1910
  )
1884
1911
 
1885
1912
  response = pipeline_response.http_response
1886
1913
 
1887
1914
  if response.status_code not in [200]:
1915
+ if _stream:
1916
+ response.read() # Load the body in memory and close the socket
1888
1917
  map_error(
1889
1918
  status_code=response.status_code, response=response, error_map=error_map
1890
1919
  )
@@ -1893,9 +1922,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1893
1922
  deserialized = self._deserialize("[InsertedJob]", pipeline_response)
1894
1923
 
1895
1924
  if cls:
1896
- return cls(pipeline_response, deserialized, {})
1925
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1897
1926
 
1898
- return deserialized
1927
+ return deserialized # type: ignore
1899
1928
 
1900
1929
  @distributed_trace
1901
1930
  def delete_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
@@ -1922,23 +1951,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1922
1951
 
1923
1952
  cls: ClsType[Any] = kwargs.pop("cls", None)
1924
1953
 
1925
- request = build_jobs_delete_bulk_jobs_request(
1954
+ _request = build_jobs_delete_bulk_jobs_request(
1926
1955
  job_ids=job_ids,
1927
1956
  headers=_headers,
1928
1957
  params=_params,
1929
1958
  )
1930
- request.url = self._client.format_url(request.url)
1959
+ _request.url = self._client.format_url(_request.url)
1931
1960
 
1932
1961
  _stream = False
1933
1962
  pipeline_response: PipelineResponse = (
1934
1963
  self._client._pipeline.run( # pylint: disable=protected-access
1935
- request, stream=_stream, **kwargs
1964
+ _request, stream=_stream, **kwargs
1936
1965
  )
1937
1966
  )
1938
1967
 
1939
1968
  response = pipeline_response.http_response
1940
1969
 
1941
1970
  if response.status_code not in [200]:
1971
+ if _stream:
1972
+ response.read() # Load the body in memory and close the socket
1942
1973
  map_error(
1943
1974
  status_code=response.status_code, response=response, error_map=error_map
1944
1975
  )
@@ -1947,9 +1978,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1947
1978
  deserialized = self._deserialize("object", pipeline_response)
1948
1979
 
1949
1980
  if cls:
1950
- return cls(pipeline_response, deserialized, {})
1981
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1951
1982
 
1952
- return deserialized
1983
+ return deserialized # type: ignore
1953
1984
 
1954
1985
  @distributed_trace
1955
1986
  def kill_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
@@ -1976,23 +2007,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1976
2007
 
1977
2008
  cls: ClsType[Any] = kwargs.pop("cls", None)
1978
2009
 
1979
- request = build_jobs_kill_bulk_jobs_request(
2010
+ _request = build_jobs_kill_bulk_jobs_request(
1980
2011
  job_ids=job_ids,
1981
2012
  headers=_headers,
1982
2013
  params=_params,
1983
2014
  )
1984
- request.url = self._client.format_url(request.url)
2015
+ _request.url = self._client.format_url(_request.url)
1985
2016
 
1986
2017
  _stream = False
1987
2018
  pipeline_response: PipelineResponse = (
1988
2019
  self._client._pipeline.run( # pylint: disable=protected-access
1989
- request, stream=_stream, **kwargs
2020
+ _request, stream=_stream, **kwargs
1990
2021
  )
1991
2022
  )
1992
2023
 
1993
2024
  response = pipeline_response.http_response
1994
2025
 
1995
2026
  if response.status_code not in [200]:
2027
+ if _stream:
2028
+ response.read() # Load the body in memory and close the socket
1996
2029
  map_error(
1997
2030
  status_code=response.status_code, response=response, error_map=error_map
1998
2031
  )
@@ -2001,9 +2034,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2001
2034
  deserialized = self._deserialize("object", pipeline_response)
2002
2035
 
2003
2036
  if cls:
2004
- return cls(pipeline_response, deserialized, {})
2037
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2005
2038
 
2006
- return deserialized
2039
+ return deserialized # type: ignore
2007
2040
 
2008
2041
  @distributed_trace
2009
2042
  def remove_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
@@ -2034,23 +2067,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2034
2067
 
2035
2068
  cls: ClsType[Any] = kwargs.pop("cls", None)
2036
2069
 
2037
- request = build_jobs_remove_bulk_jobs_request(
2070
+ _request = build_jobs_remove_bulk_jobs_request(
2038
2071
  job_ids=job_ids,
2039
2072
  headers=_headers,
2040
2073
  params=_params,
2041
2074
  )
2042
- request.url = self._client.format_url(request.url)
2075
+ _request.url = self._client.format_url(_request.url)
2043
2076
 
2044
2077
  _stream = False
2045
2078
  pipeline_response: PipelineResponse = (
2046
2079
  self._client._pipeline.run( # pylint: disable=protected-access
2047
- request, stream=_stream, **kwargs
2080
+ _request, stream=_stream, **kwargs
2048
2081
  )
2049
2082
  )
2050
2083
 
2051
2084
  response = pipeline_response.http_response
2052
2085
 
2053
2086
  if response.status_code not in [200]:
2087
+ if _stream:
2088
+ response.read() # Load the body in memory and close the socket
2054
2089
  map_error(
2055
2090
  status_code=response.status_code, response=response, error_map=error_map
2056
2091
  )
@@ -2059,9 +2094,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2059
2094
  deserialized = self._deserialize("object", pipeline_response)
2060
2095
 
2061
2096
  if cls:
2062
- return cls(pipeline_response, deserialized, {})
2097
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2063
2098
 
2064
- return deserialized
2099
+ return deserialized # type: ignore
2065
2100
 
2066
2101
  @distributed_trace
2067
2102
  def get_job_status_bulk(
@@ -2092,23 +2127,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2092
2127
  "cls", None
2093
2128
  )
2094
2129
 
2095
- request = build_jobs_get_job_status_bulk_request(
2130
+ _request = build_jobs_get_job_status_bulk_request(
2096
2131
  job_ids=job_ids,
2097
2132
  headers=_headers,
2098
2133
  params=_params,
2099
2134
  )
2100
- request.url = self._client.format_url(request.url)
2135
+ _request.url = self._client.format_url(_request.url)
2101
2136
 
2102
2137
  _stream = False
2103
2138
  pipeline_response: PipelineResponse = (
2104
2139
  self._client._pipeline.run( # pylint: disable=protected-access
2105
- request, stream=_stream, **kwargs
2140
+ _request, stream=_stream, **kwargs
2106
2141
  )
2107
2142
  )
2108
2143
 
2109
2144
  response = pipeline_response.http_response
2110
2145
 
2111
2146
  if response.status_code not in [200]:
2147
+ if _stream:
2148
+ response.read() # Load the body in memory and close the socket
2112
2149
  map_error(
2113
2150
  status_code=response.status_code, response=response, error_map=error_map
2114
2151
  )
@@ -2117,9 +2154,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2117
2154
  deserialized = self._deserialize("{LimitedJobStatusReturn}", pipeline_response)
2118
2155
 
2119
2156
  if cls:
2120
- return cls(pipeline_response, deserialized, {})
2157
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2121
2158
 
2122
- return deserialized
2159
+ return deserialized # type: ignore
2123
2160
 
2124
2161
  @overload
2125
2162
  def set_job_status_bulk(
@@ -2149,7 +2186,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2149
2186
  @overload
2150
2187
  def set_job_status_bulk(
2151
2188
  self,
2152
- body: IO,
2189
+ body: IO[bytes],
2153
2190
  *,
2154
2191
  force: bool = False,
2155
2192
  content_type: str = "application/json",
@@ -2160,7 +2197,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2160
2197
  Set Job Status Bulk.
2161
2198
 
2162
2199
  :param body: Required.
2163
- :type body: IO
2200
+ :type body: IO[bytes]
2164
2201
  :keyword force: Default value is False.
2165
2202
  :paramtype force: bool
2166
2203
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -2174,7 +2211,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2174
2211
  @distributed_trace
2175
2212
  def set_job_status_bulk(
2176
2213
  self,
2177
- body: Union[Dict[str, Dict[str, _models.JobStatusUpdate]], IO],
2214
+ body: Union[Dict[str, Dict[str, _models.JobStatusUpdate]], IO[bytes]],
2178
2215
  *,
2179
2216
  force: bool = False,
2180
2217
  **kwargs: Any,
@@ -2183,13 +2220,10 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2183
2220
 
2184
2221
  Set Job Status Bulk.
2185
2222
 
2186
- :param body: Is either a {str: {str: JobStatusUpdate}} type or a IO type. Required.
2187
- :type body: dict[str, dict[str, ~client.models.JobStatusUpdate]] or IO
2223
+ :param body: Is either a {str: {str: JobStatusUpdate}} type or a IO[bytes] type. Required.
2224
+ :type body: dict[str, dict[str, ~client.models.JobStatusUpdate]] or IO[bytes]
2188
2225
  :keyword force: Default value is False.
2189
2226
  :paramtype force: bool
2190
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
2191
- Default value is None.
2192
- :paramtype content_type: str
2193
2227
  :return: dict mapping str to SetJobStatusReturn
2194
2228
  :rtype: dict[str, ~client.models.SetJobStatusReturn]
2195
2229
  :raises ~azure.core.exceptions.HttpResponseError:
@@ -2218,7 +2252,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2218
2252
  else:
2219
2253
  _json = self._serialize.body(body, "{{JobStatusUpdate}}")
2220
2254
 
2221
- request = build_jobs_set_job_status_bulk_request(
2255
+ _request = build_jobs_set_job_status_bulk_request(
2222
2256
  force=force,
2223
2257
  content_type=content_type,
2224
2258
  json=_json,
@@ -2226,18 +2260,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2226
2260
  headers=_headers,
2227
2261
  params=_params,
2228
2262
  )
2229
- request.url = self._client.format_url(request.url)
2263
+ _request.url = self._client.format_url(_request.url)
2230
2264
 
2231
2265
  _stream = False
2232
2266
  pipeline_response: PipelineResponse = (
2233
2267
  self._client._pipeline.run( # pylint: disable=protected-access
2234
- request, stream=_stream, **kwargs
2268
+ _request, stream=_stream, **kwargs
2235
2269
  )
2236
2270
  )
2237
2271
 
2238
2272
  response = pipeline_response.http_response
2239
2273
 
2240
2274
  if response.status_code not in [200]:
2275
+ if _stream:
2276
+ response.read() # Load the body in memory and close the socket
2241
2277
  map_error(
2242
2278
  status_code=response.status_code, response=response, error_map=error_map
2243
2279
  )
@@ -2246,9 +2282,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2246
2282
  deserialized = self._deserialize("{SetJobStatusReturn}", pipeline_response)
2247
2283
 
2248
2284
  if cls:
2249
- return cls(pipeline_response, deserialized, {})
2285
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2250
2286
 
2251
- return deserialized
2287
+ return deserialized # type: ignore
2252
2288
 
2253
2289
  @distributed_trace
2254
2290
  def get_job_status_history_bulk(
@@ -2277,23 +2313,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2277
2313
 
2278
2314
  cls: ClsType[Dict[str, List[_models.JobStatusReturn]]] = kwargs.pop("cls", None)
2279
2315
 
2280
- request = build_jobs_get_job_status_history_bulk_request(
2316
+ _request = build_jobs_get_job_status_history_bulk_request(
2281
2317
  job_ids=job_ids,
2282
2318
  headers=_headers,
2283
2319
  params=_params,
2284
2320
  )
2285
- request.url = self._client.format_url(request.url)
2321
+ _request.url = self._client.format_url(_request.url)
2286
2322
 
2287
2323
  _stream = False
2288
2324
  pipeline_response: PipelineResponse = (
2289
2325
  self._client._pipeline.run( # pylint: disable=protected-access
2290
- request, stream=_stream, **kwargs
2326
+ _request, stream=_stream, **kwargs
2291
2327
  )
2292
2328
  )
2293
2329
 
2294
2330
  response = pipeline_response.http_response
2295
2331
 
2296
2332
  if response.status_code not in [200]:
2333
+ if _stream:
2334
+ response.read() # Load the body in memory and close the socket
2297
2335
  map_error(
2298
2336
  status_code=response.status_code, response=response, error_map=error_map
2299
2337
  )
@@ -2302,9 +2340,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2302
2340
  deserialized = self._deserialize("{[JobStatusReturn]}", pipeline_response)
2303
2341
 
2304
2342
  if cls:
2305
- return cls(pipeline_response, deserialized, {})
2343
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2306
2344
 
2307
- return deserialized
2345
+ return deserialized # type: ignore
2308
2346
 
2309
2347
  @distributed_trace
2310
2348
  def reschedule_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
@@ -2331,23 +2369,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2331
2369
 
2332
2370
  cls: ClsType[Any] = kwargs.pop("cls", None)
2333
2371
 
2334
- request = build_jobs_reschedule_bulk_jobs_request(
2372
+ _request = build_jobs_reschedule_bulk_jobs_request(
2335
2373
  job_ids=job_ids,
2336
2374
  headers=_headers,
2337
2375
  params=_params,
2338
2376
  )
2339
- request.url = self._client.format_url(request.url)
2377
+ _request.url = self._client.format_url(_request.url)
2340
2378
 
2341
2379
  _stream = False
2342
2380
  pipeline_response: PipelineResponse = (
2343
2381
  self._client._pipeline.run( # pylint: disable=protected-access
2344
- request, stream=_stream, **kwargs
2382
+ _request, stream=_stream, **kwargs
2345
2383
  )
2346
2384
  )
2347
2385
 
2348
2386
  response = pipeline_response.http_response
2349
2387
 
2350
2388
  if response.status_code not in [200]:
2389
+ if _stream:
2390
+ response.read() # Load the body in memory and close the socket
2351
2391
  map_error(
2352
2392
  status_code=response.status_code, response=response, error_map=error_map
2353
2393
  )
@@ -2356,9 +2396,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2356
2396
  deserialized = self._deserialize("object", pipeline_response)
2357
2397
 
2358
2398
  if cls:
2359
- return cls(pipeline_response, deserialized, {})
2399
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2360
2400
 
2361
- return deserialized
2401
+ return deserialized # type: ignore
2362
2402
 
2363
2403
  @distributed_trace
2364
2404
  def reschedule_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2385,23 +2425,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2385
2425
 
2386
2426
  cls: ClsType[Any] = kwargs.pop("cls", None)
2387
2427
 
2388
- request = build_jobs_reschedule_single_job_request(
2428
+ _request = build_jobs_reschedule_single_job_request(
2389
2429
  job_id=job_id,
2390
2430
  headers=_headers,
2391
2431
  params=_params,
2392
2432
  )
2393
- request.url = self._client.format_url(request.url)
2433
+ _request.url = self._client.format_url(_request.url)
2394
2434
 
2395
2435
  _stream = False
2396
2436
  pipeline_response: PipelineResponse = (
2397
2437
  self._client._pipeline.run( # pylint: disable=protected-access
2398
- request, stream=_stream, **kwargs
2438
+ _request, stream=_stream, **kwargs
2399
2439
  )
2400
2440
  )
2401
2441
 
2402
2442
  response = pipeline_response.http_response
2403
2443
 
2404
2444
  if response.status_code not in [200]:
2445
+ if _stream:
2446
+ response.read() # Load the body in memory and close the socket
2405
2447
  map_error(
2406
2448
  status_code=response.status_code, response=response, error_map=error_map
2407
2449
  )
@@ -2410,9 +2452,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2410
2452
  deserialized = self._deserialize("object", pipeline_response)
2411
2453
 
2412
2454
  if cls:
2413
- return cls(pipeline_response, deserialized, {})
2455
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2414
2456
 
2415
- return deserialized
2457
+ return deserialized # type: ignore
2416
2458
 
2417
2459
  @overload
2418
2460
  def search(
@@ -2447,7 +2489,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2447
2489
  @overload
2448
2490
  def search(
2449
2491
  self,
2450
- body: Optional[IO] = None,
2492
+ body: Optional[IO[bytes]] = None,
2451
2493
  *,
2452
2494
  page: int = 0,
2453
2495
  per_page: int = 100,
@@ -2461,7 +2503,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2461
2503
  **TODO: Add more docs**.
2462
2504
 
2463
2505
  :param body: Default value is None.
2464
- :type body: IO
2506
+ :type body: IO[bytes]
2465
2507
  :keyword page: Default value is 0.
2466
2508
  :paramtype page: int
2467
2509
  :keyword per_page: Default value is 100.
@@ -2477,7 +2519,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2477
2519
  @distributed_trace
2478
2520
  def search(
2479
2521
  self,
2480
- body: Optional[Union[_models.JobSearchParams, IO]] = None,
2522
+ body: Optional[Union[_models.JobSearchParams, IO[bytes]]] = None,
2481
2523
  *,
2482
2524
  page: int = 0,
2483
2525
  per_page: int = 100,
@@ -2489,15 +2531,12 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2489
2531
 
2490
2532
  **TODO: Add more docs**.
2491
2533
 
2492
- :param body: Is either a JobSearchParams type or a IO type. Default value is None.
2493
- :type body: ~client.models.JobSearchParams or IO
2534
+ :param body: Is either a JobSearchParams type or a IO[bytes] type. Default value is None.
2535
+ :type body: ~client.models.JobSearchParams or IO[bytes]
2494
2536
  :keyword page: Default value is 0.
2495
2537
  :paramtype page: int
2496
2538
  :keyword per_page: Default value is 100.
2497
2539
  :paramtype per_page: int
2498
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
2499
- Default value is None.
2500
- :paramtype content_type: str
2501
2540
  :return: list of JSON
2502
2541
  :rtype: list[JSON]
2503
2542
  :raises ~azure.core.exceptions.HttpResponseError:
@@ -2529,7 +2568,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2529
2568
  else:
2530
2569
  _json = None
2531
2570
 
2532
- request = build_jobs_search_request(
2571
+ _request = build_jobs_search_request(
2533
2572
  page=page,
2534
2573
  per_page=per_page,
2535
2574
  content_type=content_type,
@@ -2538,18 +2577,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2538
2577
  headers=_headers,
2539
2578
  params=_params,
2540
2579
  )
2541
- request.url = self._client.format_url(request.url)
2580
+ _request.url = self._client.format_url(_request.url)
2542
2581
 
2543
2582
  _stream = False
2544
2583
  pipeline_response: PipelineResponse = (
2545
2584
  self._client._pipeline.run( # pylint: disable=protected-access
2546
- request, stream=_stream, **kwargs
2585
+ _request, stream=_stream, **kwargs
2547
2586
  )
2548
2587
  )
2549
2588
 
2550
2589
  response = pipeline_response.http_response
2551
2590
 
2552
2591
  if response.status_code not in [200]:
2592
+ if _stream:
2593
+ response.read() # Load the body in memory and close the socket
2553
2594
  map_error(
2554
2595
  status_code=response.status_code, response=response, error_map=error_map
2555
2596
  )
@@ -2558,9 +2599,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2558
2599
  deserialized = self._deserialize("[object]", pipeline_response)
2559
2600
 
2560
2601
  if cls:
2561
- return cls(pipeline_response, deserialized, {})
2602
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2562
2603
 
2563
- return deserialized
2604
+ return deserialized # type: ignore
2564
2605
 
2565
2606
  @overload
2566
2607
  def summary(
@@ -2586,14 +2627,14 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2586
2627
 
2587
2628
  @overload
2588
2629
  def summary(
2589
- self, body: IO, *, content_type: str = "application/json", **kwargs: Any
2630
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
2590
2631
  ) -> Any:
2591
2632
  """Summary.
2592
2633
 
2593
2634
  Show information suitable for plotting.
2594
2635
 
2595
2636
  :param body: Required.
2596
- :type body: IO
2637
+ :type body: IO[bytes]
2597
2638
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
2598
2639
  Default value is "application/json".
2599
2640
  :paramtype content_type: str
@@ -2603,16 +2644,15 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2603
2644
  """
2604
2645
 
2605
2646
  @distributed_trace
2606
- def summary(self, body: Union[_models.JobSummaryParams, IO], **kwargs: Any) -> Any:
2647
+ def summary(
2648
+ self, body: Union[_models.JobSummaryParams, IO[bytes]], **kwargs: Any
2649
+ ) -> Any:
2607
2650
  """Summary.
2608
2651
 
2609
2652
  Show information suitable for plotting.
2610
2653
 
2611
- :param body: Is either a JobSummaryParams type or a IO type. Required.
2612
- :type body: ~client.models.JobSummaryParams or IO
2613
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
2614
- Default value is None.
2615
- :paramtype content_type: str
2654
+ :param body: Is either a JobSummaryParams type or a IO[bytes] type. Required.
2655
+ :type body: ~client.models.JobSummaryParams or IO[bytes]
2616
2656
  :return: any
2617
2657
  :rtype: any
2618
2658
  :raises ~azure.core.exceptions.HttpResponseError:
@@ -2641,25 +2681,27 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2641
2681
  else:
2642
2682
  _json = self._serialize.body(body, "JobSummaryParams")
2643
2683
 
2644
- request = build_jobs_summary_request(
2684
+ _request = build_jobs_summary_request(
2645
2685
  content_type=content_type,
2646
2686
  json=_json,
2647
2687
  content=_content,
2648
2688
  headers=_headers,
2649
2689
  params=_params,
2650
2690
  )
2651
- request.url = self._client.format_url(request.url)
2691
+ _request.url = self._client.format_url(_request.url)
2652
2692
 
2653
2693
  _stream = False
2654
2694
  pipeline_response: PipelineResponse = (
2655
2695
  self._client._pipeline.run( # pylint: disable=protected-access
2656
- request, stream=_stream, **kwargs
2696
+ _request, stream=_stream, **kwargs
2657
2697
  )
2658
2698
  )
2659
2699
 
2660
2700
  response = pipeline_response.http_response
2661
2701
 
2662
2702
  if response.status_code not in [200]:
2703
+ if _stream:
2704
+ response.read() # Load the body in memory and close the socket
2663
2705
  map_error(
2664
2706
  status_code=response.status_code, response=response, error_map=error_map
2665
2707
  )
@@ -2668,9 +2710,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2668
2710
  deserialized = self._deserialize("object", pipeline_response)
2669
2711
 
2670
2712
  if cls:
2671
- return cls(pipeline_response, deserialized, {})
2713
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2672
2714
 
2673
- return deserialized
2715
+ return deserialized # type: ignore
2674
2716
 
2675
2717
  @distributed_trace
2676
2718
  def get_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2697,23 +2739,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2697
2739
 
2698
2740
  cls: ClsType[Any] = kwargs.pop("cls", None)
2699
2741
 
2700
- request = build_jobs_get_single_job_request(
2742
+ _request = build_jobs_get_single_job_request(
2701
2743
  job_id=job_id,
2702
2744
  headers=_headers,
2703
2745
  params=_params,
2704
2746
  )
2705
- request.url = self._client.format_url(request.url)
2747
+ _request.url = self._client.format_url(_request.url)
2706
2748
 
2707
2749
  _stream = False
2708
2750
  pipeline_response: PipelineResponse = (
2709
2751
  self._client._pipeline.run( # pylint: disable=protected-access
2710
- request, stream=_stream, **kwargs
2752
+ _request, stream=_stream, **kwargs
2711
2753
  )
2712
2754
  )
2713
2755
 
2714
2756
  response = pipeline_response.http_response
2715
2757
 
2716
2758
  if response.status_code not in [200]:
2759
+ if _stream:
2760
+ response.read() # Load the body in memory and close the socket
2717
2761
  map_error(
2718
2762
  status_code=response.status_code, response=response, error_map=error_map
2719
2763
  )
@@ -2722,9 +2766,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2722
2766
  deserialized = self._deserialize("object", pipeline_response)
2723
2767
 
2724
2768
  if cls:
2725
- return cls(pipeline_response, deserialized, {})
2769
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2726
2770
 
2727
- return deserialized
2771
+ return deserialized # type: ignore
2728
2772
 
2729
2773
  @distributed_trace
2730
2774
  def delete_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2751,23 +2795,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2751
2795
 
2752
2796
  cls: ClsType[Any] = kwargs.pop("cls", None)
2753
2797
 
2754
- request = build_jobs_delete_single_job_request(
2798
+ _request = build_jobs_delete_single_job_request(
2755
2799
  job_id=job_id,
2756
2800
  headers=_headers,
2757
2801
  params=_params,
2758
2802
  )
2759
- request.url = self._client.format_url(request.url)
2803
+ _request.url = self._client.format_url(_request.url)
2760
2804
 
2761
2805
  _stream = False
2762
2806
  pipeline_response: PipelineResponse = (
2763
2807
  self._client._pipeline.run( # pylint: disable=protected-access
2764
- request, stream=_stream, **kwargs
2808
+ _request, stream=_stream, **kwargs
2765
2809
  )
2766
2810
  )
2767
2811
 
2768
2812
  response = pipeline_response.http_response
2769
2813
 
2770
2814
  if response.status_code not in [200]:
2815
+ if _stream:
2816
+ response.read() # Load the body in memory and close the socket
2771
2817
  map_error(
2772
2818
  status_code=response.status_code, response=response, error_map=error_map
2773
2819
  )
@@ -2776,9 +2822,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2776
2822
  deserialized = self._deserialize("object", pipeline_response)
2777
2823
 
2778
2824
  if cls:
2779
- return cls(pipeline_response, deserialized, {})
2825
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2780
2826
 
2781
- return deserialized
2827
+ return deserialized # type: ignore
2782
2828
 
2783
2829
  @distributed_trace
2784
2830
  def set_single_job_properties(
@@ -2816,7 +2862,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2816
2862
 
2817
2863
  _json = self._serialize.body(body, "object")
2818
2864
 
2819
- request = build_jobs_set_single_job_properties_request(
2865
+ _request = build_jobs_set_single_job_properties_request(
2820
2866
  job_id=job_id,
2821
2867
  update_timestamp=update_timestamp,
2822
2868
  content_type=content_type,
@@ -2824,18 +2870,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2824
2870
  headers=_headers,
2825
2871
  params=_params,
2826
2872
  )
2827
- request.url = self._client.format_url(request.url)
2873
+ _request.url = self._client.format_url(_request.url)
2828
2874
 
2829
2875
  _stream = False
2830
2876
  pipeline_response: PipelineResponse = (
2831
2877
  self._client._pipeline.run( # pylint: disable=protected-access
2832
- request, stream=_stream, **kwargs
2878
+ _request, stream=_stream, **kwargs
2833
2879
  )
2834
2880
  )
2835
2881
 
2836
2882
  response = pipeline_response.http_response
2837
2883
 
2838
2884
  if response.status_code not in [200]:
2885
+ if _stream:
2886
+ response.read() # Load the body in memory and close the socket
2839
2887
  map_error(
2840
2888
  status_code=response.status_code, response=response, error_map=error_map
2841
2889
  )
@@ -2844,9 +2892,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2844
2892
  deserialized = self._deserialize("object", pipeline_response)
2845
2893
 
2846
2894
  if cls:
2847
- return cls(pipeline_response, deserialized, {})
2895
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2848
2896
 
2849
- return deserialized
2897
+ return deserialized # type: ignore
2850
2898
 
2851
2899
  @distributed_trace
2852
2900
  def kill_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2873,23 +2921,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2873
2921
 
2874
2922
  cls: ClsType[Any] = kwargs.pop("cls", None)
2875
2923
 
2876
- request = build_jobs_kill_single_job_request(
2924
+ _request = build_jobs_kill_single_job_request(
2877
2925
  job_id=job_id,
2878
2926
  headers=_headers,
2879
2927
  params=_params,
2880
2928
  )
2881
- request.url = self._client.format_url(request.url)
2929
+ _request.url = self._client.format_url(_request.url)
2882
2930
 
2883
2931
  _stream = False
2884
2932
  pipeline_response: PipelineResponse = (
2885
2933
  self._client._pipeline.run( # pylint: disable=protected-access
2886
- request, stream=_stream, **kwargs
2934
+ _request, stream=_stream, **kwargs
2887
2935
  )
2888
2936
  )
2889
2937
 
2890
2938
  response = pipeline_response.http_response
2891
2939
 
2892
2940
  if response.status_code not in [200]:
2941
+ if _stream:
2942
+ response.read() # Load the body in memory and close the socket
2893
2943
  map_error(
2894
2944
  status_code=response.status_code, response=response, error_map=error_map
2895
2945
  )
@@ -2898,9 +2948,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2898
2948
  deserialized = self._deserialize("object", pipeline_response)
2899
2949
 
2900
2950
  if cls:
2901
- return cls(pipeline_response, deserialized, {})
2951
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2902
2952
 
2903
- return deserialized
2953
+ return deserialized # type: ignore
2904
2954
 
2905
2955
  @distributed_trace
2906
2956
  def remove_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2931,23 +2981,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2931
2981
 
2932
2982
  cls: ClsType[Any] = kwargs.pop("cls", None)
2933
2983
 
2934
- request = build_jobs_remove_single_job_request(
2984
+ _request = build_jobs_remove_single_job_request(
2935
2985
  job_id=job_id,
2936
2986
  headers=_headers,
2937
2987
  params=_params,
2938
2988
  )
2939
- request.url = self._client.format_url(request.url)
2989
+ _request.url = self._client.format_url(_request.url)
2940
2990
 
2941
2991
  _stream = False
2942
2992
  pipeline_response: PipelineResponse = (
2943
2993
  self._client._pipeline.run( # pylint: disable=protected-access
2944
- request, stream=_stream, **kwargs
2994
+ _request, stream=_stream, **kwargs
2945
2995
  )
2946
2996
  )
2947
2997
 
2948
2998
  response = pipeline_response.http_response
2949
2999
 
2950
3000
  if response.status_code not in [200]:
3001
+ if _stream:
3002
+ response.read() # Load the body in memory and close the socket
2951
3003
  map_error(
2952
3004
  status_code=response.status_code, response=response, error_map=error_map
2953
3005
  )
@@ -2956,9 +3008,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2956
3008
  deserialized = self._deserialize("object", pipeline_response)
2957
3009
 
2958
3010
  if cls:
2959
- return cls(pipeline_response, deserialized, {})
3011
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2960
3012
 
2961
- return deserialized
3013
+ return deserialized # type: ignore
2962
3014
 
2963
3015
  @distributed_trace
2964
3016
  def get_single_job_status(
@@ -2989,23 +3041,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2989
3041
  "cls", None
2990
3042
  )
2991
3043
 
2992
- request = build_jobs_get_single_job_status_request(
3044
+ _request = build_jobs_get_single_job_status_request(
2993
3045
  job_id=job_id,
2994
3046
  headers=_headers,
2995
3047
  params=_params,
2996
3048
  )
2997
- request.url = self._client.format_url(request.url)
3049
+ _request.url = self._client.format_url(_request.url)
2998
3050
 
2999
3051
  _stream = False
3000
3052
  pipeline_response: PipelineResponse = (
3001
3053
  self._client._pipeline.run( # pylint: disable=protected-access
3002
- request, stream=_stream, **kwargs
3054
+ _request, stream=_stream, **kwargs
3003
3055
  )
3004
3056
  )
3005
3057
 
3006
3058
  response = pipeline_response.http_response
3007
3059
 
3008
3060
  if response.status_code not in [200]:
3061
+ if _stream:
3062
+ response.read() # Load the body in memory and close the socket
3009
3063
  map_error(
3010
3064
  status_code=response.status_code, response=response, error_map=error_map
3011
3065
  )
@@ -3014,9 +3068,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3014
3068
  deserialized = self._deserialize("{LimitedJobStatusReturn}", pipeline_response)
3015
3069
 
3016
3070
  if cls:
3017
- return cls(pipeline_response, deserialized, {})
3071
+ return cls(pipeline_response, deserialized, {}) # type: ignore
3018
3072
 
3019
- return deserialized
3073
+ return deserialized # type: ignore
3020
3074
 
3021
3075
  @overload
3022
3076
  def set_single_job_status(
@@ -3050,7 +3104,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3050
3104
  def set_single_job_status(
3051
3105
  self,
3052
3106
  job_id: int,
3053
- body: IO,
3107
+ body: IO[bytes],
3054
3108
  *,
3055
3109
  force: bool = False,
3056
3110
  content_type: str = "application/json",
@@ -3063,7 +3117,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3063
3117
  :param job_id: Required.
3064
3118
  :type job_id: int
3065
3119
  :param body: Required.
3066
- :type body: IO
3120
+ :type body: IO[bytes]
3067
3121
  :keyword force: Default value is False.
3068
3122
  :paramtype force: bool
3069
3123
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -3078,7 +3132,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3078
3132
  def set_single_job_status(
3079
3133
  self,
3080
3134
  job_id: int,
3081
- body: Union[Dict[str, _models.JobStatusUpdate], IO],
3135
+ body: Union[Dict[str, _models.JobStatusUpdate], IO[bytes]],
3082
3136
  *,
3083
3137
  force: bool = False,
3084
3138
  **kwargs: Any,
@@ -3089,13 +3143,10 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3089
3143
 
3090
3144
  :param job_id: Required.
3091
3145
  :type job_id: int
3092
- :param body: Is either a {str: JobStatusUpdate} type or a IO type. Required.
3093
- :type body: dict[str, ~client.models.JobStatusUpdate] or IO
3146
+ :param body: Is either a {str: JobStatusUpdate} type or a IO[bytes] type. Required.
3147
+ :type body: dict[str, ~client.models.JobStatusUpdate] or IO[bytes]
3094
3148
  :keyword force: Default value is False.
3095
3149
  :paramtype force: bool
3096
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
3097
- Default value is None.
3098
- :paramtype content_type: str
3099
3150
  :return: dict mapping str to SetJobStatusReturn
3100
3151
  :rtype: dict[str, ~client.models.SetJobStatusReturn]
3101
3152
  :raises ~azure.core.exceptions.HttpResponseError:
@@ -3124,7 +3175,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3124
3175
  else:
3125
3176
  _json = self._serialize.body(body, "{JobStatusUpdate}")
3126
3177
 
3127
- request = build_jobs_set_single_job_status_request(
3178
+ _request = build_jobs_set_single_job_status_request(
3128
3179
  job_id=job_id,
3129
3180
  force=force,
3130
3181
  content_type=content_type,
@@ -3133,18 +3184,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3133
3184
  headers=_headers,
3134
3185
  params=_params,
3135
3186
  )
3136
- request.url = self._client.format_url(request.url)
3187
+ _request.url = self._client.format_url(_request.url)
3137
3188
 
3138
3189
  _stream = False
3139
3190
  pipeline_response: PipelineResponse = (
3140
3191
  self._client._pipeline.run( # pylint: disable=protected-access
3141
- request, stream=_stream, **kwargs
3192
+ _request, stream=_stream, **kwargs
3142
3193
  )
3143
3194
  )
3144
3195
 
3145
3196
  response = pipeline_response.http_response
3146
3197
 
3147
3198
  if response.status_code not in [200]:
3199
+ if _stream:
3200
+ response.read() # Load the body in memory and close the socket
3148
3201
  map_error(
3149
3202
  status_code=response.status_code, response=response, error_map=error_map
3150
3203
  )
@@ -3153,9 +3206,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3153
3206
  deserialized = self._deserialize("{SetJobStatusReturn}", pipeline_response)
3154
3207
 
3155
3208
  if cls:
3156
- return cls(pipeline_response, deserialized, {})
3209
+ return cls(pipeline_response, deserialized, {}) # type: ignore
3157
3210
 
3158
- return deserialized
3211
+ return deserialized # type: ignore
3159
3212
 
3160
3213
  @distributed_trace
3161
3214
  def get_single_job_status_history(
@@ -3184,23 +3237,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3184
3237
 
3185
3238
  cls: ClsType[Dict[str, List[_models.JobStatusReturn]]] = kwargs.pop("cls", None)
3186
3239
 
3187
- request = build_jobs_get_single_job_status_history_request(
3240
+ _request = build_jobs_get_single_job_status_history_request(
3188
3241
  job_id=job_id,
3189
3242
  headers=_headers,
3190
3243
  params=_params,
3191
3244
  )
3192
- request.url = self._client.format_url(request.url)
3245
+ _request.url = self._client.format_url(_request.url)
3193
3246
 
3194
3247
  _stream = False
3195
3248
  pipeline_response: PipelineResponse = (
3196
3249
  self._client._pipeline.run( # pylint: disable=protected-access
3197
- request, stream=_stream, **kwargs
3250
+ _request, stream=_stream, **kwargs
3198
3251
  )
3199
3252
  )
3200
3253
 
3201
3254
  response = pipeline_response.http_response
3202
3255
 
3203
3256
  if response.status_code not in [200]:
3257
+ if _stream:
3258
+ response.read() # Load the body in memory and close the socket
3204
3259
  map_error(
3205
3260
  status_code=response.status_code, response=response, error_map=error_map
3206
3261
  )
@@ -3209,6 +3264,6 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3209
3264
  deserialized = self._deserialize("{[JobStatusReturn]}", pipeline_response)
3210
3265
 
3211
3266
  if cls:
3212
- return cls(pipeline_response, deserialized, {})
3267
+ return cls(pipeline_response, deserialized, {}) # type: ignore
3213
3268
 
3214
- return deserialized
3269
+ return deserialized # type: ignore