diracx-client 0.0.1a11__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,24 +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
267
  *,
268
- if_none_match: Optional[str] = None,
269
268
  if_modified_since: Optional[str] = None,
269
+ etag: Optional[str] = None,
270
+ match_condition: Optional[MatchConditions] = None,
270
271
  **kwargs: Any,
271
272
  ) -> HttpRequest:
272
273
  _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
@@ -277,15 +278,19 @@ def build_config_serve_config_request(
277
278
  _url = "/api/config/"
278
279
 
279
280
  # Construct headers
280
- if if_none_match is not None:
281
- _headers["if-none-match"] = _SERIALIZER.header(
282
- "if_none_match", if_none_match, "str"
283
- )
284
281
  if if_modified_since is not None:
285
282
  _headers["if-modified-since"] = _SERIALIZER.header(
286
283
  "if_modified_since", if_modified_since, "str"
287
284
  )
288
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
+ )
289
294
 
290
295
  return HttpRequest(method="GET", url=_url, headers=_headers, **kwargs)
291
296
 
@@ -533,7 +538,7 @@ def build_jobs_reschedule_single_job_request(job_id: int, **kwargs: Any) -> Http
533
538
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
534
539
  }
535
540
 
536
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
541
+ _url: str = _url.format(**path_format_arguments) # type: ignore
537
542
 
538
543
  # Construct headers
539
544
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -605,7 +610,7 @@ def build_jobs_get_single_job_request(job_id: int, **kwargs: Any) -> HttpRequest
605
610
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
606
611
  }
607
612
 
608
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
613
+ _url: str = _url.format(**path_format_arguments) # type: ignore
609
614
 
610
615
  # Construct headers
611
616
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -624,7 +629,7 @@ def build_jobs_delete_single_job_request(job_id: int, **kwargs: Any) -> HttpRequ
624
629
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
625
630
  }
626
631
 
627
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
632
+ _url: str = _url.format(**path_format_arguments) # type: ignore
628
633
 
629
634
  # Construct headers
630
635
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -649,7 +654,7 @@ def build_jobs_set_single_job_properties_request( # pylint: disable=name-too-lo
649
654
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
650
655
  }
651
656
 
652
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
657
+ _url: str = _url.format(**path_format_arguments) # type: ignore
653
658
 
654
659
  # Construct parameters
655
660
  if update_timestamp is not None:
@@ -680,7 +685,7 @@ def build_jobs_kill_single_job_request(job_id: int, **kwargs: Any) -> HttpReques
680
685
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
681
686
  }
682
687
 
683
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
688
+ _url: str = _url.format(**path_format_arguments) # type: ignore
684
689
 
685
690
  # Construct headers
686
691
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -699,7 +704,7 @@ def build_jobs_remove_single_job_request(job_id: int, **kwargs: Any) -> HttpRequ
699
704
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
700
705
  }
701
706
 
702
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
707
+ _url: str = _url.format(**path_format_arguments) # type: ignore
703
708
 
704
709
  # Construct headers
705
710
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -718,7 +723,7 @@ def build_jobs_get_single_job_status_request(job_id: int, **kwargs: Any) -> Http
718
723
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
719
724
  }
720
725
 
721
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
726
+ _url: str = _url.format(**path_format_arguments) # type: ignore
722
727
 
723
728
  # Construct headers
724
729
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -743,7 +748,7 @@ def build_jobs_set_single_job_status_request(
743
748
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
744
749
  }
745
750
 
746
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
751
+ _url: str = _url.format(**path_format_arguments) # type: ignore
747
752
 
748
753
  # Construct parameters
749
754
  if force is not None:
@@ -774,7 +779,7 @@ def build_jobs_get_single_job_status_history_request( # pylint: disable=name-to
774
779
  "job_id": _SERIALIZER.url("job_id", job_id, "int"),
775
780
  }
776
781
 
777
- _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore
782
+ _url: str = _url.format(**path_format_arguments) # type: ignore
778
783
 
779
784
  # Construct headers
780
785
  _headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
@@ -826,22 +831,24 @@ class WellKnownOperations:
826
831
 
827
832
  cls: ClsType[Any] = kwargs.pop("cls", None)
828
833
 
829
- request = build_well_known_openid_configuration_request(
834
+ _request = build_well_known_openid_configuration_request(
830
835
  headers=_headers,
831
836
  params=_params,
832
837
  )
833
- request.url = self._client.format_url(request.url)
838
+ _request.url = self._client.format_url(_request.url)
834
839
 
835
840
  _stream = False
836
841
  pipeline_response: PipelineResponse = (
837
842
  self._client._pipeline.run( # pylint: disable=protected-access
838
- request, stream=_stream, **kwargs
843
+ _request, stream=_stream, **kwargs
839
844
  )
840
845
  )
841
846
 
842
847
  response = pipeline_response.http_response
843
848
 
844
849
  if response.status_code not in [200]:
850
+ if _stream:
851
+ response.read() # Load the body in memory and close the socket
845
852
  map_error(
846
853
  status_code=response.status_code, response=response, error_map=error_map
847
854
  )
@@ -850,9 +857,9 @@ class WellKnownOperations:
850
857
  deserialized = self._deserialize("object", pipeline_response)
851
858
 
852
859
  if cls:
853
- return cls(pipeline_response, deserialized, {})
860
+ return cls(pipeline_response, deserialized, {}) # type: ignore
854
861
 
855
- return deserialized
862
+ return deserialized # type: ignore
856
863
 
857
864
  @distributed_trace
858
865
  def installation_metadata(self, **kwargs: Any) -> _models.Metadata:
@@ -877,22 +884,24 @@ class WellKnownOperations:
877
884
 
878
885
  cls: ClsType[_models.Metadata] = kwargs.pop("cls", None)
879
886
 
880
- request = build_well_known_installation_metadata_request(
887
+ _request = build_well_known_installation_metadata_request(
881
888
  headers=_headers,
882
889
  params=_params,
883
890
  )
884
- request.url = self._client.format_url(request.url)
891
+ _request.url = self._client.format_url(_request.url)
885
892
 
886
893
  _stream = False
887
894
  pipeline_response: PipelineResponse = (
888
895
  self._client._pipeline.run( # pylint: disable=protected-access
889
- request, stream=_stream, **kwargs
896
+ _request, stream=_stream, **kwargs
890
897
  )
891
898
  )
892
899
 
893
900
  response = pipeline_response.http_response
894
901
 
895
902
  if response.status_code not in [200]:
903
+ if _stream:
904
+ response.read() # Load the body in memory and close the socket
896
905
  map_error(
897
906
  status_code=response.status_code, response=response, error_map=error_map
898
907
  )
@@ -901,12 +910,12 @@ class WellKnownOperations:
901
910
  deserialized = self._deserialize("Metadata", pipeline_response)
902
911
 
903
912
  if cls:
904
- return cls(pipeline_response, deserialized, {})
913
+ return cls(pipeline_response, deserialized, {}) # type: ignore
905
914
 
906
- return deserialized
915
+ return deserialized # type: ignore
907
916
 
908
917
 
909
- class AuthOperations:
918
+ class AuthOperations: # pylint: disable=abstract-class-instantiated
910
919
  """
911
920
  .. warning::
912
921
  **DO NOT** instantiate this class directly.
@@ -926,6 +935,7 @@ class AuthOperations:
926
935
  self._deserialize = (
927
936
  input_args.pop(0) if input_args else kwargs.pop("deserializer")
928
937
  )
938
+
929
939
  raise_if_not_implemented(
930
940
  self.__class__,
931
941
  [
@@ -965,23 +975,25 @@ class AuthOperations:
965
975
 
966
976
  cls: ClsType[Any] = kwargs.pop("cls", None)
967
977
 
968
- request = build_auth_do_device_flow_request(
978
+ _request = build_auth_do_device_flow_request(
969
979
  user_code=user_code,
970
980
  headers=_headers,
971
981
  params=_params,
972
982
  )
973
- request.url = self._client.format_url(request.url)
983
+ _request.url = self._client.format_url(_request.url)
974
984
 
975
985
  _stream = False
976
986
  pipeline_response: PipelineResponse = (
977
987
  self._client._pipeline.run( # pylint: disable=protected-access
978
- request, stream=_stream, **kwargs
988
+ _request, stream=_stream, **kwargs
979
989
  )
980
990
  )
981
991
 
982
992
  response = pipeline_response.http_response
983
993
 
984
994
  if response.status_code not in [200]:
995
+ if _stream:
996
+ response.read() # Load the body in memory and close the socket
985
997
  map_error(
986
998
  status_code=response.status_code, response=response, error_map=error_map
987
999
  )
@@ -990,13 +1002,13 @@ class AuthOperations:
990
1002
  deserialized = self._deserialize("object", pipeline_response)
991
1003
 
992
1004
  if cls:
993
- return cls(pipeline_response, deserialized, {})
1005
+ return cls(pipeline_response, deserialized, {}) # type: ignore
994
1006
 
995
- return deserialized
1007
+ return deserialized # type: ignore
996
1008
 
997
1009
  @distributed_trace
998
1010
  def initiate_device_flow(
999
- self, *, client_id: str, scope: str, audience: str, **kwargs: Any
1011
+ self, *, client_id: str, scope: str, **kwargs: Any
1000
1012
  ) -> _models.InitiateDeviceFlowResponse:
1001
1013
  """Initiate Device Flow.
1002
1014
 
@@ -1012,8 +1024,6 @@ class AuthOperations:
1012
1024
  :paramtype client_id: str
1013
1025
  :keyword scope: Required.
1014
1026
  :paramtype scope: str
1015
- :keyword audience: Required.
1016
- :paramtype audience: str
1017
1027
  :return: InitiateDeviceFlowResponse
1018
1028
  :rtype: ~client.models.InitiateDeviceFlowResponse
1019
1029
  :raises ~azure.core.exceptions.HttpResponseError:
@@ -1031,25 +1041,26 @@ class AuthOperations:
1031
1041
 
1032
1042
  cls: ClsType[_models.InitiateDeviceFlowResponse] = kwargs.pop("cls", None)
1033
1043
 
1034
- request = build_auth_initiate_device_flow_request(
1044
+ _request = build_auth_initiate_device_flow_request(
1035
1045
  client_id=client_id,
1036
1046
  scope=scope,
1037
- audience=audience,
1038
1047
  headers=_headers,
1039
1048
  params=_params,
1040
1049
  )
1041
- request.url = self._client.format_url(request.url)
1050
+ _request.url = self._client.format_url(_request.url)
1042
1051
 
1043
1052
  _stream = False
1044
1053
  pipeline_response: PipelineResponse = (
1045
1054
  self._client._pipeline.run( # pylint: disable=protected-access
1046
- request, stream=_stream, **kwargs
1055
+ _request, stream=_stream, **kwargs
1047
1056
  )
1048
1057
  )
1049
1058
 
1050
1059
  response = pipeline_response.http_response
1051
1060
 
1052
1061
  if response.status_code not in [200]:
1062
+ if _stream:
1063
+ response.read() # Load the body in memory and close the socket
1053
1064
  map_error(
1054
1065
  status_code=response.status_code, response=response, error_map=error_map
1055
1066
  )
@@ -1060,9 +1071,9 @@ class AuthOperations:
1060
1071
  )
1061
1072
 
1062
1073
  if cls:
1063
- return cls(pipeline_response, deserialized, {})
1074
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1064
1075
 
1065
- return deserialized
1076
+ return deserialized # type: ignore
1066
1077
 
1067
1078
  @distributed_trace
1068
1079
  def finish_device_flow(self, *, code: str, state: str, **kwargs: Any) -> Any:
@@ -1095,24 +1106,26 @@ class AuthOperations:
1095
1106
 
1096
1107
  cls: ClsType[Any] = kwargs.pop("cls", None)
1097
1108
 
1098
- request = build_auth_finish_device_flow_request(
1109
+ _request = build_auth_finish_device_flow_request(
1099
1110
  code=code,
1100
1111
  state=state,
1101
1112
  headers=_headers,
1102
1113
  params=_params,
1103
1114
  )
1104
- request.url = self._client.format_url(request.url)
1115
+ _request.url = self._client.format_url(_request.url)
1105
1116
 
1106
1117
  _stream = False
1107
1118
  pipeline_response: PipelineResponse = (
1108
1119
  self._client._pipeline.run( # pylint: disable=protected-access
1109
- request, stream=_stream, **kwargs
1120
+ _request, stream=_stream, **kwargs
1110
1121
  )
1111
1122
  )
1112
1123
 
1113
1124
  response = pipeline_response.http_response
1114
1125
 
1115
1126
  if response.status_code not in [200]:
1127
+ if _stream:
1128
+ response.read() # Load the body in memory and close the socket
1116
1129
  map_error(
1117
1130
  status_code=response.status_code, response=response, error_map=error_map
1118
1131
  )
@@ -1121,9 +1134,9 @@ class AuthOperations:
1121
1134
  deserialized = self._deserialize("object", pipeline_response)
1122
1135
 
1123
1136
  if cls:
1124
- return cls(pipeline_response, deserialized, {})
1137
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1125
1138
 
1126
- return deserialized
1139
+ return deserialized # type: ignore
1127
1140
 
1128
1141
  @distributed_trace
1129
1142
  def finished(self, **kwargs: Any) -> Any:
@@ -1148,22 +1161,24 @@ class AuthOperations:
1148
1161
 
1149
1162
  cls: ClsType[Any] = kwargs.pop("cls", None)
1150
1163
 
1151
- request = build_auth_finished_request(
1164
+ _request = build_auth_finished_request(
1152
1165
  headers=_headers,
1153
1166
  params=_params,
1154
1167
  )
1155
- request.url = self._client.format_url(request.url)
1168
+ _request.url = self._client.format_url(_request.url)
1156
1169
 
1157
1170
  _stream = False
1158
1171
  pipeline_response: PipelineResponse = (
1159
1172
  self._client._pipeline.run( # pylint: disable=protected-access
1160
- request, stream=_stream, **kwargs
1173
+ _request, stream=_stream, **kwargs
1161
1174
  )
1162
1175
  )
1163
1176
 
1164
1177
  response = pipeline_response.http_response
1165
1178
 
1166
1179
  if response.status_code not in [200]:
1180
+ if _stream:
1181
+ response.read() # Load the body in memory and close the socket
1167
1182
  map_error(
1168
1183
  status_code=response.status_code, response=response, error_map=error_map
1169
1184
  )
@@ -1172,15 +1187,16 @@ class AuthOperations:
1172
1187
  deserialized = self._deserialize("object", pipeline_response)
1173
1188
 
1174
1189
  if cls:
1175
- return cls(pipeline_response, deserialized, {})
1190
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1176
1191
 
1177
- return deserialized
1192
+ return deserialized # type: ignore
1178
1193
 
1179
1194
  @distributed_trace
1180
1195
  def get_refresh_tokens(self, **kwargs: Any) -> List[Any]:
1181
1196
  """Get Refresh Tokens.
1182
1197
 
1183
- 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.
1184
1200
 
1185
1201
  :return: list of any
1186
1202
  :rtype: list[any]
@@ -1199,22 +1215,24 @@ class AuthOperations:
1199
1215
 
1200
1216
  cls: ClsType[List[Any]] = kwargs.pop("cls", None)
1201
1217
 
1202
- request = build_auth_get_refresh_tokens_request(
1218
+ _request = build_auth_get_refresh_tokens_request(
1203
1219
  headers=_headers,
1204
1220
  params=_params,
1205
1221
  )
1206
- request.url = self._client.format_url(request.url)
1222
+ _request.url = self._client.format_url(_request.url)
1207
1223
 
1208
1224
  _stream = False
1209
1225
  pipeline_response: PipelineResponse = (
1210
1226
  self._client._pipeline.run( # pylint: disable=protected-access
1211
- request, stream=_stream, **kwargs
1227
+ _request, stream=_stream, **kwargs
1212
1228
  )
1213
1229
  )
1214
1230
 
1215
1231
  response = pipeline_response.http_response
1216
1232
 
1217
1233
  if response.status_code not in [200]:
1234
+ if _stream:
1235
+ response.read() # Load the body in memory and close the socket
1218
1236
  map_error(
1219
1237
  status_code=response.status_code, response=response, error_map=error_map
1220
1238
  )
@@ -1223,15 +1241,16 @@ class AuthOperations:
1223
1241
  deserialized = self._deserialize("[object]", pipeline_response)
1224
1242
 
1225
1243
  if cls:
1226
- return cls(pipeline_response, deserialized, {})
1244
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1227
1245
 
1228
- return deserialized
1246
+ return deserialized # type: ignore
1229
1247
 
1230
1248
  @distributed_trace
1231
1249
  def revoke_refresh_token(self, jti: str, **kwargs: Any) -> str:
1232
1250
  """Revoke Refresh Token.
1233
1251
 
1234
- 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.
1235
1254
 
1236
1255
  :param jti: Required.
1237
1256
  :type jti: str
@@ -1252,23 +1271,25 @@ class AuthOperations:
1252
1271
 
1253
1272
  cls: ClsType[str] = kwargs.pop("cls", None)
1254
1273
 
1255
- request = build_auth_revoke_refresh_token_request(
1274
+ _request = build_auth_revoke_refresh_token_request(
1256
1275
  jti=jti,
1257
1276
  headers=_headers,
1258
1277
  params=_params,
1259
1278
  )
1260
- request.url = self._client.format_url(request.url)
1279
+ _request.url = self._client.format_url(_request.url)
1261
1280
 
1262
1281
  _stream = False
1263
1282
  pipeline_response: PipelineResponse = (
1264
1283
  self._client._pipeline.run( # pylint: disable=protected-access
1265
- request, stream=_stream, **kwargs
1284
+ _request, stream=_stream, **kwargs
1266
1285
  )
1267
1286
  )
1268
1287
 
1269
1288
  response = pipeline_response.http_response
1270
1289
 
1271
1290
  if response.status_code not in [200]:
1291
+ if _stream:
1292
+ response.read() # Load the body in memory and close the socket
1272
1293
  map_error(
1273
1294
  status_code=response.status_code, response=response, error_map=error_map
1274
1295
  )
@@ -1277,17 +1298,70 @@ class AuthOperations:
1277
1298
  deserialized = self._deserialize("str", pipeline_response)
1278
1299
 
1279
1300
  if cls:
1280
- return cls(pipeline_response, deserialized, {})
1301
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1281
1302
 
1282
- return deserialized
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
1355
+
1356
+ return deserialized # type: ignore
1283
1357
 
1284
1358
  @distributed_trace
1285
1359
  def authorization_flow(
1286
1360
  self,
1287
1361
  *,
1288
- response_type: Union[str, _models.Enum3],
1362
+ response_type: Union[str, _models.Enum0],
1289
1363
  code_challenge: str,
1290
- code_challenge_method: Union[str, _models.Enum4],
1364
+ code_challenge_method: Union[str, _models.Enum1],
1291
1365
  client_id: str,
1292
1366
  redirect_uri: str,
1293
1367
  scope: str,
@@ -1299,11 +1373,11 @@ class AuthOperations:
1299
1373
  Authorization Flow.
1300
1374
 
1301
1375
  :keyword response_type: "code" Required.
1302
- :paramtype response_type: str or ~client.models.Enum3
1376
+ :paramtype response_type: str or ~client.models.Enum0
1303
1377
  :keyword code_challenge: Required.
1304
1378
  :paramtype code_challenge: str
1305
1379
  :keyword code_challenge_method: "S256" Required.
1306
- :paramtype code_challenge_method: str or ~client.models.Enum4
1380
+ :paramtype code_challenge_method: str or ~client.models.Enum1
1307
1381
  :keyword client_id: Required.
1308
1382
  :paramtype client_id: str
1309
1383
  :keyword redirect_uri: Required.
@@ -1329,7 +1403,7 @@ class AuthOperations:
1329
1403
 
1330
1404
  cls: ClsType[Any] = kwargs.pop("cls", None)
1331
1405
 
1332
- request = build_auth_authorization_flow_request(
1406
+ _request = build_auth_authorization_flow_request(
1333
1407
  response_type=response_type,
1334
1408
  code_challenge=code_challenge,
1335
1409
  code_challenge_method=code_challenge_method,
@@ -1340,18 +1414,20 @@ class AuthOperations:
1340
1414
  headers=_headers,
1341
1415
  params=_params,
1342
1416
  )
1343
- request.url = self._client.format_url(request.url)
1417
+ _request.url = self._client.format_url(_request.url)
1344
1418
 
1345
1419
  _stream = False
1346
1420
  pipeline_response: PipelineResponse = (
1347
1421
  self._client._pipeline.run( # pylint: disable=protected-access
1348
- request, stream=_stream, **kwargs
1422
+ _request, stream=_stream, **kwargs
1349
1423
  )
1350
1424
  )
1351
1425
 
1352
1426
  response = pipeline_response.http_response
1353
1427
 
1354
1428
  if response.status_code not in [200]:
1429
+ if _stream:
1430
+ response.read() # Load the body in memory and close the socket
1355
1431
  map_error(
1356
1432
  status_code=response.status_code, response=response, error_map=error_map
1357
1433
  )
@@ -1360,9 +1436,9 @@ class AuthOperations:
1360
1436
  deserialized = self._deserialize("object", pipeline_response)
1361
1437
 
1362
1438
  if cls:
1363
- return cls(pipeline_response, deserialized, {})
1439
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1364
1440
 
1365
- return deserialized
1441
+ return deserialized # type: ignore
1366
1442
 
1367
1443
  @distributed_trace
1368
1444
  def authorization_flow_complete(
@@ -1393,24 +1469,26 @@ class AuthOperations:
1393
1469
 
1394
1470
  cls: ClsType[Any] = kwargs.pop("cls", None)
1395
1471
 
1396
- request = build_auth_authorization_flow_complete_request(
1472
+ _request = build_auth_authorization_flow_complete_request(
1397
1473
  code=code,
1398
1474
  state=state,
1399
1475
  headers=_headers,
1400
1476
  params=_params,
1401
1477
  )
1402
- request.url = self._client.format_url(request.url)
1478
+ _request.url = self._client.format_url(_request.url)
1403
1479
 
1404
1480
  _stream = False
1405
1481
  pipeline_response: PipelineResponse = (
1406
1482
  self._client._pipeline.run( # pylint: disable=protected-access
1407
- request, stream=_stream, **kwargs
1483
+ _request, stream=_stream, **kwargs
1408
1484
  )
1409
1485
  )
1410
1486
 
1411
1487
  response = pipeline_response.http_response
1412
1488
 
1413
1489
  if response.status_code not in [200]:
1490
+ if _stream:
1491
+ response.read() # Load the body in memory and close the socket
1414
1492
  map_error(
1415
1493
  status_code=response.status_code, response=response, error_map=error_map
1416
1494
  )
@@ -1419,60 +1497,9 @@ class AuthOperations:
1419
1497
  deserialized = self._deserialize("object", pipeline_response)
1420
1498
 
1421
1499
  if cls:
1422
- return cls(pipeline_response, deserialized, {})
1423
-
1424
- return deserialized
1425
-
1426
- @distributed_trace
1427
- def userinfo(self, **kwargs: Any) -> _models.UserInfoResponse:
1428
- """Userinfo.
1429
-
1430
- Userinfo.
1431
-
1432
- :return: UserInfoResponse
1433
- :rtype: ~client.models.UserInfoResponse
1434
- :raises ~azure.core.exceptions.HttpResponseError:
1435
- """
1436
- error_map = {
1437
- 401: ClientAuthenticationError,
1438
- 404: ResourceNotFoundError,
1439
- 409: ResourceExistsError,
1440
- 304: ResourceNotModifiedError,
1441
- }
1442
- error_map.update(kwargs.pop("error_map", {}) or {})
1443
-
1444
- _headers = kwargs.pop("headers", {}) or {}
1445
- _params = kwargs.pop("params", {}) or {}
1446
-
1447
- cls: ClsType[_models.UserInfoResponse] = kwargs.pop("cls", None)
1448
-
1449
- request = build_auth_userinfo_request(
1450
- headers=_headers,
1451
- params=_params,
1452
- )
1453
- request.url = self._client.format_url(request.url)
1454
-
1455
- _stream = False
1456
- pipeline_response: PipelineResponse = (
1457
- self._client._pipeline.run( # pylint: disable=protected-access
1458
- request, stream=_stream, **kwargs
1459
- )
1460
- )
1461
-
1462
- response = pipeline_response.http_response
1463
-
1464
- if response.status_code not in [200]:
1465
- map_error(
1466
- status_code=response.status_code, response=response, error_map=error_map
1467
- )
1468
- raise HttpResponseError(response=response)
1469
-
1470
- deserialized = self._deserialize("UserInfoResponse", pipeline_response)
1471
-
1472
- if cls:
1473
- return cls(pipeline_response, deserialized, {})
1500
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1474
1501
 
1475
- return deserialized
1502
+ return deserialized # type: ignore
1476
1503
 
1477
1504
 
1478
1505
  class ConfigOperations:
@@ -1500,8 +1527,9 @@ class ConfigOperations:
1500
1527
  def serve_config(
1501
1528
  self,
1502
1529
  *,
1503
- if_none_match: Optional[str] = None,
1504
1530
  if_modified_since: Optional[str] = None,
1531
+ etag: Optional[str] = None,
1532
+ match_condition: Optional[MatchConditions] = None,
1505
1533
  **kwargs: Any,
1506
1534
  ) -> Any:
1507
1535
  """Serve Config.
@@ -1513,10 +1541,13 @@ class ConfigOperations:
1513
1541
  If If-Modified-Since is given and is newer than latest,
1514
1542
  return 304: this is to avoid flip/flopping.
1515
1543
 
1516
- :keyword if_none_match: Default value is None.
1517
- :paramtype if_none_match: str
1518
1544
  :keyword if_modified_since: Default value is None.
1519
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
1520
1551
  :return: any
1521
1552
  :rtype: any
1522
1553
  :raises ~azure.core.exceptions.HttpResponseError:
@@ -1527,6 +1558,12 @@ class ConfigOperations:
1527
1558
  409: ResourceExistsError,
1528
1559
  304: ResourceNotModifiedError,
1529
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
1530
1567
  error_map.update(kwargs.pop("error_map", {}) or {})
1531
1568
 
1532
1569
  _headers = kwargs.pop("headers", {}) or {}
@@ -1534,24 +1571,27 @@ class ConfigOperations:
1534
1571
 
1535
1572
  cls: ClsType[Any] = kwargs.pop("cls", None)
1536
1573
 
1537
- request = build_config_serve_config_request(
1538
- if_none_match=if_none_match,
1574
+ _request = build_config_serve_config_request(
1539
1575
  if_modified_since=if_modified_since,
1576
+ etag=etag,
1577
+ match_condition=match_condition,
1540
1578
  headers=_headers,
1541
1579
  params=_params,
1542
1580
  )
1543
- request.url = self._client.format_url(request.url)
1581
+ _request.url = self._client.format_url(_request.url)
1544
1582
 
1545
1583
  _stream = False
1546
1584
  pipeline_response: PipelineResponse = (
1547
1585
  self._client._pipeline.run( # pylint: disable=protected-access
1548
- request, stream=_stream, **kwargs
1586
+ _request, stream=_stream, **kwargs
1549
1587
  )
1550
1588
  )
1551
1589
 
1552
1590
  response = pipeline_response.http_response
1553
1591
 
1554
1592
  if response.status_code not in [200]:
1593
+ if _stream:
1594
+ response.read() # Load the body in memory and close the socket
1555
1595
  map_error(
1556
1596
  status_code=response.status_code, response=response, error_map=error_map
1557
1597
  )
@@ -1560,9 +1600,9 @@ class ConfigOperations:
1560
1600
  deserialized = self._deserialize("object", pipeline_response)
1561
1601
 
1562
1602
  if cls:
1563
- return cls(pipeline_response, deserialized, {})
1603
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1564
1604
 
1565
- return deserialized
1605
+ return deserialized # type: ignore
1566
1606
 
1567
1607
 
1568
1608
  class JobsOperations: # pylint: disable=too-many-public-methods
@@ -1619,23 +1659,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1619
1659
 
1620
1660
  cls: ClsType[_models.SandboxDownloadResponse] = kwargs.pop("cls", None)
1621
1661
 
1622
- request = build_jobs_get_sandbox_file_request(
1662
+ _request = build_jobs_get_sandbox_file_request(
1623
1663
  pfn=pfn,
1624
1664
  headers=_headers,
1625
1665
  params=_params,
1626
1666
  )
1627
- request.url = self._client.format_url(request.url)
1667
+ _request.url = self._client.format_url(_request.url)
1628
1668
 
1629
1669
  _stream = False
1630
1670
  pipeline_response: PipelineResponse = (
1631
1671
  self._client._pipeline.run( # pylint: disable=protected-access
1632
- request, stream=_stream, **kwargs
1672
+ _request, stream=_stream, **kwargs
1633
1673
  )
1634
1674
  )
1635
1675
 
1636
1676
  response = pipeline_response.http_response
1637
1677
 
1638
1678
  if response.status_code not in [200]:
1679
+ if _stream:
1680
+ response.read() # Load the body in memory and close the socket
1639
1681
  map_error(
1640
1682
  status_code=response.status_code, response=response, error_map=error_map
1641
1683
  )
@@ -1644,9 +1686,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1644
1686
  deserialized = self._deserialize("SandboxDownloadResponse", pipeline_response)
1645
1687
 
1646
1688
  if cls:
1647
- return cls(pipeline_response, deserialized, {})
1689
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1648
1690
 
1649
- return deserialized
1691
+ return deserialized # type: ignore
1650
1692
 
1651
1693
  @overload
1652
1694
  def initiate_sandbox_upload(
@@ -1678,7 +1720,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1678
1720
 
1679
1721
  @overload
1680
1722
  def initiate_sandbox_upload(
1681
- self, body: IO, *, content_type: str = "application/json", **kwargs: Any
1723
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
1682
1724
  ) -> _models.SandboxUploadResponse:
1683
1725
  """Initiate Sandbox Upload.
1684
1726
 
@@ -1691,7 +1733,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1691
1733
  should be used to upload the sandbox to the storage backend.
1692
1734
 
1693
1735
  :param body: Required.
1694
- :type body: IO
1736
+ :type body: IO[bytes]
1695
1737
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1696
1738
  Default value is "application/json".
1697
1739
  :paramtype content_type: str
@@ -1702,7 +1744,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1702
1744
 
1703
1745
  @distributed_trace
1704
1746
  def initiate_sandbox_upload(
1705
- self, body: Union[_models.SandboxInfo, IO], **kwargs: Any
1747
+ self, body: Union[_models.SandboxInfo, IO[bytes]], **kwargs: Any
1706
1748
  ) -> _models.SandboxUploadResponse:
1707
1749
  """Initiate Sandbox Upload.
1708
1750
 
@@ -1714,11 +1756,8 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1714
1756
  If the sandbox does not exist in the database then the "url" and "fields"
1715
1757
  should be used to upload the sandbox to the storage backend.
1716
1758
 
1717
- :param body: Is either a SandboxInfo type or a IO type. Required.
1718
- :type body: ~client.models.SandboxInfo or IO
1719
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
1720
- Default value is None.
1721
- :paramtype content_type: str
1759
+ :param body: Is either a SandboxInfo type or a IO[bytes] type. Required.
1760
+ :type body: ~client.models.SandboxInfo or IO[bytes]
1722
1761
  :return: SandboxUploadResponse
1723
1762
  :rtype: ~client.models.SandboxUploadResponse
1724
1763
  :raises ~azure.core.exceptions.HttpResponseError:
@@ -1747,25 +1786,27 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1747
1786
  else:
1748
1787
  _json = self._serialize.body(body, "SandboxInfo")
1749
1788
 
1750
- request = build_jobs_initiate_sandbox_upload_request(
1789
+ _request = build_jobs_initiate_sandbox_upload_request(
1751
1790
  content_type=content_type,
1752
1791
  json=_json,
1753
1792
  content=_content,
1754
1793
  headers=_headers,
1755
1794
  params=_params,
1756
1795
  )
1757
- request.url = self._client.format_url(request.url)
1796
+ _request.url = self._client.format_url(_request.url)
1758
1797
 
1759
1798
  _stream = False
1760
1799
  pipeline_response: PipelineResponse = (
1761
1800
  self._client._pipeline.run( # pylint: disable=protected-access
1762
- request, stream=_stream, **kwargs
1801
+ _request, stream=_stream, **kwargs
1763
1802
  )
1764
1803
  )
1765
1804
 
1766
1805
  response = pipeline_response.http_response
1767
1806
 
1768
1807
  if response.status_code not in [200]:
1808
+ if _stream:
1809
+ response.read() # Load the body in memory and close the socket
1769
1810
  map_error(
1770
1811
  status_code=response.status_code, response=response, error_map=error_map
1771
1812
  )
@@ -1774,9 +1815,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1774
1815
  deserialized = self._deserialize("SandboxUploadResponse", pipeline_response)
1775
1816
 
1776
1817
  if cls:
1777
- return cls(pipeline_response, deserialized, {})
1818
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1778
1819
 
1779
- return deserialized
1820
+ return deserialized # type: ignore
1780
1821
 
1781
1822
  @overload
1782
1823
  def submit_bulk_jobs(
@@ -1798,14 +1839,14 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1798
1839
 
1799
1840
  @overload
1800
1841
  def submit_bulk_jobs(
1801
- self, body: IO, *, content_type: str = "application/json", **kwargs: Any
1842
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
1802
1843
  ) -> List[_models.InsertedJob]:
1803
1844
  """Submit Bulk Jobs.
1804
1845
 
1805
1846
  Submit Bulk Jobs.
1806
1847
 
1807
1848
  :param body: Required.
1808
- :type body: IO
1849
+ :type body: IO[bytes]
1809
1850
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
1810
1851
  Default value is "application/json".
1811
1852
  :paramtype content_type: str
@@ -1816,17 +1857,14 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1816
1857
 
1817
1858
  @distributed_trace
1818
1859
  def submit_bulk_jobs(
1819
- self, body: Union[List[str], IO], **kwargs: Any
1860
+ self, body: Union[List[str], IO[bytes]], **kwargs: Any
1820
1861
  ) -> List[_models.InsertedJob]:
1821
1862
  """Submit Bulk Jobs.
1822
1863
 
1823
1864
  Submit Bulk Jobs.
1824
1865
 
1825
- :param body: Is either a [str] type or a IO type. Required.
1826
- :type body: list[str] or IO
1827
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
1828
- Default value is None.
1829
- :paramtype content_type: str
1866
+ :param body: Is either a [str] type or a IO[bytes] type. Required.
1867
+ :type body: list[str] or IO[bytes]
1830
1868
  :return: list of InsertedJob
1831
1869
  :rtype: list[~client.models.InsertedJob]
1832
1870
  :raises ~azure.core.exceptions.HttpResponseError:
@@ -1855,25 +1893,27 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1855
1893
  else:
1856
1894
  _json = self._serialize.body(body, "[str]")
1857
1895
 
1858
- request = build_jobs_submit_bulk_jobs_request(
1896
+ _request = build_jobs_submit_bulk_jobs_request(
1859
1897
  content_type=content_type,
1860
1898
  json=_json,
1861
1899
  content=_content,
1862
1900
  headers=_headers,
1863
1901
  params=_params,
1864
1902
  )
1865
- request.url = self._client.format_url(request.url)
1903
+ _request.url = self._client.format_url(_request.url)
1866
1904
 
1867
1905
  _stream = False
1868
1906
  pipeline_response: PipelineResponse = (
1869
1907
  self._client._pipeline.run( # pylint: disable=protected-access
1870
- request, stream=_stream, **kwargs
1908
+ _request, stream=_stream, **kwargs
1871
1909
  )
1872
1910
  )
1873
1911
 
1874
1912
  response = pipeline_response.http_response
1875
1913
 
1876
1914
  if response.status_code not in [200]:
1915
+ if _stream:
1916
+ response.read() # Load the body in memory and close the socket
1877
1917
  map_error(
1878
1918
  status_code=response.status_code, response=response, error_map=error_map
1879
1919
  )
@@ -1882,9 +1922,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1882
1922
  deserialized = self._deserialize("[InsertedJob]", pipeline_response)
1883
1923
 
1884
1924
  if cls:
1885
- return cls(pipeline_response, deserialized, {})
1925
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1886
1926
 
1887
- return deserialized
1927
+ return deserialized # type: ignore
1888
1928
 
1889
1929
  @distributed_trace
1890
1930
  def delete_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
@@ -1911,23 +1951,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1911
1951
 
1912
1952
  cls: ClsType[Any] = kwargs.pop("cls", None)
1913
1953
 
1914
- request = build_jobs_delete_bulk_jobs_request(
1954
+ _request = build_jobs_delete_bulk_jobs_request(
1915
1955
  job_ids=job_ids,
1916
1956
  headers=_headers,
1917
1957
  params=_params,
1918
1958
  )
1919
- request.url = self._client.format_url(request.url)
1959
+ _request.url = self._client.format_url(_request.url)
1920
1960
 
1921
1961
  _stream = False
1922
1962
  pipeline_response: PipelineResponse = (
1923
1963
  self._client._pipeline.run( # pylint: disable=protected-access
1924
- request, stream=_stream, **kwargs
1964
+ _request, stream=_stream, **kwargs
1925
1965
  )
1926
1966
  )
1927
1967
 
1928
1968
  response = pipeline_response.http_response
1929
1969
 
1930
1970
  if response.status_code not in [200]:
1971
+ if _stream:
1972
+ response.read() # Load the body in memory and close the socket
1931
1973
  map_error(
1932
1974
  status_code=response.status_code, response=response, error_map=error_map
1933
1975
  )
@@ -1936,9 +1978,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1936
1978
  deserialized = self._deserialize("object", pipeline_response)
1937
1979
 
1938
1980
  if cls:
1939
- return cls(pipeline_response, deserialized, {})
1981
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1940
1982
 
1941
- return deserialized
1983
+ return deserialized # type: ignore
1942
1984
 
1943
1985
  @distributed_trace
1944
1986
  def kill_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
@@ -1965,23 +2007,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1965
2007
 
1966
2008
  cls: ClsType[Any] = kwargs.pop("cls", None)
1967
2009
 
1968
- request = build_jobs_kill_bulk_jobs_request(
2010
+ _request = build_jobs_kill_bulk_jobs_request(
1969
2011
  job_ids=job_ids,
1970
2012
  headers=_headers,
1971
2013
  params=_params,
1972
2014
  )
1973
- request.url = self._client.format_url(request.url)
2015
+ _request.url = self._client.format_url(_request.url)
1974
2016
 
1975
2017
  _stream = False
1976
2018
  pipeline_response: PipelineResponse = (
1977
2019
  self._client._pipeline.run( # pylint: disable=protected-access
1978
- request, stream=_stream, **kwargs
2020
+ _request, stream=_stream, **kwargs
1979
2021
  )
1980
2022
  )
1981
2023
 
1982
2024
  response = pipeline_response.http_response
1983
2025
 
1984
2026
  if response.status_code not in [200]:
2027
+ if _stream:
2028
+ response.read() # Load the body in memory and close the socket
1985
2029
  map_error(
1986
2030
  status_code=response.status_code, response=response, error_map=error_map
1987
2031
  )
@@ -1990,9 +2034,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
1990
2034
  deserialized = self._deserialize("object", pipeline_response)
1991
2035
 
1992
2036
  if cls:
1993
- return cls(pipeline_response, deserialized, {})
2037
+ return cls(pipeline_response, deserialized, {}) # type: ignore
1994
2038
 
1995
- return deserialized
2039
+ return deserialized # type: ignore
1996
2040
 
1997
2041
  @distributed_trace
1998
2042
  def remove_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
@@ -2023,23 +2067,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2023
2067
 
2024
2068
  cls: ClsType[Any] = kwargs.pop("cls", None)
2025
2069
 
2026
- request = build_jobs_remove_bulk_jobs_request(
2070
+ _request = build_jobs_remove_bulk_jobs_request(
2027
2071
  job_ids=job_ids,
2028
2072
  headers=_headers,
2029
2073
  params=_params,
2030
2074
  )
2031
- request.url = self._client.format_url(request.url)
2075
+ _request.url = self._client.format_url(_request.url)
2032
2076
 
2033
2077
  _stream = False
2034
2078
  pipeline_response: PipelineResponse = (
2035
2079
  self._client._pipeline.run( # pylint: disable=protected-access
2036
- request, stream=_stream, **kwargs
2080
+ _request, stream=_stream, **kwargs
2037
2081
  )
2038
2082
  )
2039
2083
 
2040
2084
  response = pipeline_response.http_response
2041
2085
 
2042
2086
  if response.status_code not in [200]:
2087
+ if _stream:
2088
+ response.read() # Load the body in memory and close the socket
2043
2089
  map_error(
2044
2090
  status_code=response.status_code, response=response, error_map=error_map
2045
2091
  )
@@ -2048,9 +2094,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2048
2094
  deserialized = self._deserialize("object", pipeline_response)
2049
2095
 
2050
2096
  if cls:
2051
- return cls(pipeline_response, deserialized, {})
2097
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2052
2098
 
2053
- return deserialized
2099
+ return deserialized # type: ignore
2054
2100
 
2055
2101
  @distributed_trace
2056
2102
  def get_job_status_bulk(
@@ -2081,23 +2127,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2081
2127
  "cls", None
2082
2128
  )
2083
2129
 
2084
- request = build_jobs_get_job_status_bulk_request(
2130
+ _request = build_jobs_get_job_status_bulk_request(
2085
2131
  job_ids=job_ids,
2086
2132
  headers=_headers,
2087
2133
  params=_params,
2088
2134
  )
2089
- request.url = self._client.format_url(request.url)
2135
+ _request.url = self._client.format_url(_request.url)
2090
2136
 
2091
2137
  _stream = False
2092
2138
  pipeline_response: PipelineResponse = (
2093
2139
  self._client._pipeline.run( # pylint: disable=protected-access
2094
- request, stream=_stream, **kwargs
2140
+ _request, stream=_stream, **kwargs
2095
2141
  )
2096
2142
  )
2097
2143
 
2098
2144
  response = pipeline_response.http_response
2099
2145
 
2100
2146
  if response.status_code not in [200]:
2147
+ if _stream:
2148
+ response.read() # Load the body in memory and close the socket
2101
2149
  map_error(
2102
2150
  status_code=response.status_code, response=response, error_map=error_map
2103
2151
  )
@@ -2106,9 +2154,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2106
2154
  deserialized = self._deserialize("{LimitedJobStatusReturn}", pipeline_response)
2107
2155
 
2108
2156
  if cls:
2109
- return cls(pipeline_response, deserialized, {})
2157
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2110
2158
 
2111
- return deserialized
2159
+ return deserialized # type: ignore
2112
2160
 
2113
2161
  @overload
2114
2162
  def set_job_status_bulk(
@@ -2138,7 +2186,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2138
2186
  @overload
2139
2187
  def set_job_status_bulk(
2140
2188
  self,
2141
- body: IO,
2189
+ body: IO[bytes],
2142
2190
  *,
2143
2191
  force: bool = False,
2144
2192
  content_type: str = "application/json",
@@ -2149,7 +2197,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2149
2197
  Set Job Status Bulk.
2150
2198
 
2151
2199
  :param body: Required.
2152
- :type body: IO
2200
+ :type body: IO[bytes]
2153
2201
  :keyword force: Default value is False.
2154
2202
  :paramtype force: bool
2155
2203
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -2163,7 +2211,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2163
2211
  @distributed_trace
2164
2212
  def set_job_status_bulk(
2165
2213
  self,
2166
- body: Union[Dict[str, Dict[str, _models.JobStatusUpdate]], IO],
2214
+ body: Union[Dict[str, Dict[str, _models.JobStatusUpdate]], IO[bytes]],
2167
2215
  *,
2168
2216
  force: bool = False,
2169
2217
  **kwargs: Any,
@@ -2172,13 +2220,10 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2172
2220
 
2173
2221
  Set Job Status Bulk.
2174
2222
 
2175
- :param body: Is either a {str: {str: JobStatusUpdate}} type or a IO type. Required.
2176
- :type body: dict[str, dict[str, ~client.models.JobStatusUpdate]] or IO
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]
2177
2225
  :keyword force: Default value is False.
2178
2226
  :paramtype force: bool
2179
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
2180
- Default value is None.
2181
- :paramtype content_type: str
2182
2227
  :return: dict mapping str to SetJobStatusReturn
2183
2228
  :rtype: dict[str, ~client.models.SetJobStatusReturn]
2184
2229
  :raises ~azure.core.exceptions.HttpResponseError:
@@ -2207,7 +2252,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2207
2252
  else:
2208
2253
  _json = self._serialize.body(body, "{{JobStatusUpdate}}")
2209
2254
 
2210
- request = build_jobs_set_job_status_bulk_request(
2255
+ _request = build_jobs_set_job_status_bulk_request(
2211
2256
  force=force,
2212
2257
  content_type=content_type,
2213
2258
  json=_json,
@@ -2215,18 +2260,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2215
2260
  headers=_headers,
2216
2261
  params=_params,
2217
2262
  )
2218
- request.url = self._client.format_url(request.url)
2263
+ _request.url = self._client.format_url(_request.url)
2219
2264
 
2220
2265
  _stream = False
2221
2266
  pipeline_response: PipelineResponse = (
2222
2267
  self._client._pipeline.run( # pylint: disable=protected-access
2223
- request, stream=_stream, **kwargs
2268
+ _request, stream=_stream, **kwargs
2224
2269
  )
2225
2270
  )
2226
2271
 
2227
2272
  response = pipeline_response.http_response
2228
2273
 
2229
2274
  if response.status_code not in [200]:
2275
+ if _stream:
2276
+ response.read() # Load the body in memory and close the socket
2230
2277
  map_error(
2231
2278
  status_code=response.status_code, response=response, error_map=error_map
2232
2279
  )
@@ -2235,9 +2282,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2235
2282
  deserialized = self._deserialize("{SetJobStatusReturn}", pipeline_response)
2236
2283
 
2237
2284
  if cls:
2238
- return cls(pipeline_response, deserialized, {})
2285
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2239
2286
 
2240
- return deserialized
2287
+ return deserialized # type: ignore
2241
2288
 
2242
2289
  @distributed_trace
2243
2290
  def get_job_status_history_bulk(
@@ -2266,23 +2313,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2266
2313
 
2267
2314
  cls: ClsType[Dict[str, List[_models.JobStatusReturn]]] = kwargs.pop("cls", None)
2268
2315
 
2269
- request = build_jobs_get_job_status_history_bulk_request(
2316
+ _request = build_jobs_get_job_status_history_bulk_request(
2270
2317
  job_ids=job_ids,
2271
2318
  headers=_headers,
2272
2319
  params=_params,
2273
2320
  )
2274
- request.url = self._client.format_url(request.url)
2321
+ _request.url = self._client.format_url(_request.url)
2275
2322
 
2276
2323
  _stream = False
2277
2324
  pipeline_response: PipelineResponse = (
2278
2325
  self._client._pipeline.run( # pylint: disable=protected-access
2279
- request, stream=_stream, **kwargs
2326
+ _request, stream=_stream, **kwargs
2280
2327
  )
2281
2328
  )
2282
2329
 
2283
2330
  response = pipeline_response.http_response
2284
2331
 
2285
2332
  if response.status_code not in [200]:
2333
+ if _stream:
2334
+ response.read() # Load the body in memory and close the socket
2286
2335
  map_error(
2287
2336
  status_code=response.status_code, response=response, error_map=error_map
2288
2337
  )
@@ -2291,9 +2340,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2291
2340
  deserialized = self._deserialize("{[JobStatusReturn]}", pipeline_response)
2292
2341
 
2293
2342
  if cls:
2294
- return cls(pipeline_response, deserialized, {})
2343
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2295
2344
 
2296
- return deserialized
2345
+ return deserialized # type: ignore
2297
2346
 
2298
2347
  @distributed_trace
2299
2348
  def reschedule_bulk_jobs(self, *, job_ids: List[int], **kwargs: Any) -> Any:
@@ -2320,23 +2369,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2320
2369
 
2321
2370
  cls: ClsType[Any] = kwargs.pop("cls", None)
2322
2371
 
2323
- request = build_jobs_reschedule_bulk_jobs_request(
2372
+ _request = build_jobs_reschedule_bulk_jobs_request(
2324
2373
  job_ids=job_ids,
2325
2374
  headers=_headers,
2326
2375
  params=_params,
2327
2376
  )
2328
- request.url = self._client.format_url(request.url)
2377
+ _request.url = self._client.format_url(_request.url)
2329
2378
 
2330
2379
  _stream = False
2331
2380
  pipeline_response: PipelineResponse = (
2332
2381
  self._client._pipeline.run( # pylint: disable=protected-access
2333
- request, stream=_stream, **kwargs
2382
+ _request, stream=_stream, **kwargs
2334
2383
  )
2335
2384
  )
2336
2385
 
2337
2386
  response = pipeline_response.http_response
2338
2387
 
2339
2388
  if response.status_code not in [200]:
2389
+ if _stream:
2390
+ response.read() # Load the body in memory and close the socket
2340
2391
  map_error(
2341
2392
  status_code=response.status_code, response=response, error_map=error_map
2342
2393
  )
@@ -2345,9 +2396,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2345
2396
  deserialized = self._deserialize("object", pipeline_response)
2346
2397
 
2347
2398
  if cls:
2348
- return cls(pipeline_response, deserialized, {})
2399
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2349
2400
 
2350
- return deserialized
2401
+ return deserialized # type: ignore
2351
2402
 
2352
2403
  @distributed_trace
2353
2404
  def reschedule_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2374,23 +2425,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2374
2425
 
2375
2426
  cls: ClsType[Any] = kwargs.pop("cls", None)
2376
2427
 
2377
- request = build_jobs_reschedule_single_job_request(
2428
+ _request = build_jobs_reschedule_single_job_request(
2378
2429
  job_id=job_id,
2379
2430
  headers=_headers,
2380
2431
  params=_params,
2381
2432
  )
2382
- request.url = self._client.format_url(request.url)
2433
+ _request.url = self._client.format_url(_request.url)
2383
2434
 
2384
2435
  _stream = False
2385
2436
  pipeline_response: PipelineResponse = (
2386
2437
  self._client._pipeline.run( # pylint: disable=protected-access
2387
- request, stream=_stream, **kwargs
2438
+ _request, stream=_stream, **kwargs
2388
2439
  )
2389
2440
  )
2390
2441
 
2391
2442
  response = pipeline_response.http_response
2392
2443
 
2393
2444
  if response.status_code not in [200]:
2445
+ if _stream:
2446
+ response.read() # Load the body in memory and close the socket
2394
2447
  map_error(
2395
2448
  status_code=response.status_code, response=response, error_map=error_map
2396
2449
  )
@@ -2399,9 +2452,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2399
2452
  deserialized = self._deserialize("object", pipeline_response)
2400
2453
 
2401
2454
  if cls:
2402
- return cls(pipeline_response, deserialized, {})
2455
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2403
2456
 
2404
- return deserialized
2457
+ return deserialized # type: ignore
2405
2458
 
2406
2459
  @overload
2407
2460
  def search(
@@ -2436,7 +2489,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2436
2489
  @overload
2437
2490
  def search(
2438
2491
  self,
2439
- body: Optional[IO] = None,
2492
+ body: Optional[IO[bytes]] = None,
2440
2493
  *,
2441
2494
  page: int = 0,
2442
2495
  per_page: int = 100,
@@ -2450,7 +2503,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2450
2503
  **TODO: Add more docs**.
2451
2504
 
2452
2505
  :param body: Default value is None.
2453
- :type body: IO
2506
+ :type body: IO[bytes]
2454
2507
  :keyword page: Default value is 0.
2455
2508
  :paramtype page: int
2456
2509
  :keyword per_page: Default value is 100.
@@ -2466,7 +2519,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2466
2519
  @distributed_trace
2467
2520
  def search(
2468
2521
  self,
2469
- body: Optional[Union[_models.JobSearchParams, IO]] = None,
2522
+ body: Optional[Union[_models.JobSearchParams, IO[bytes]]] = None,
2470
2523
  *,
2471
2524
  page: int = 0,
2472
2525
  per_page: int = 100,
@@ -2478,15 +2531,12 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2478
2531
 
2479
2532
  **TODO: Add more docs**.
2480
2533
 
2481
- :param body: Is either a JobSearchParams type or a IO type. Default value is None.
2482
- :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]
2483
2536
  :keyword page: Default value is 0.
2484
2537
  :paramtype page: int
2485
2538
  :keyword per_page: Default value is 100.
2486
2539
  :paramtype per_page: int
2487
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
2488
- Default value is None.
2489
- :paramtype content_type: str
2490
2540
  :return: list of JSON
2491
2541
  :rtype: list[JSON]
2492
2542
  :raises ~azure.core.exceptions.HttpResponseError:
@@ -2518,7 +2568,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2518
2568
  else:
2519
2569
  _json = None
2520
2570
 
2521
- request = build_jobs_search_request(
2571
+ _request = build_jobs_search_request(
2522
2572
  page=page,
2523
2573
  per_page=per_page,
2524
2574
  content_type=content_type,
@@ -2527,18 +2577,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2527
2577
  headers=_headers,
2528
2578
  params=_params,
2529
2579
  )
2530
- request.url = self._client.format_url(request.url)
2580
+ _request.url = self._client.format_url(_request.url)
2531
2581
 
2532
2582
  _stream = False
2533
2583
  pipeline_response: PipelineResponse = (
2534
2584
  self._client._pipeline.run( # pylint: disable=protected-access
2535
- request, stream=_stream, **kwargs
2585
+ _request, stream=_stream, **kwargs
2536
2586
  )
2537
2587
  )
2538
2588
 
2539
2589
  response = pipeline_response.http_response
2540
2590
 
2541
2591
  if response.status_code not in [200]:
2592
+ if _stream:
2593
+ response.read() # Load the body in memory and close the socket
2542
2594
  map_error(
2543
2595
  status_code=response.status_code, response=response, error_map=error_map
2544
2596
  )
@@ -2547,9 +2599,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2547
2599
  deserialized = self._deserialize("[object]", pipeline_response)
2548
2600
 
2549
2601
  if cls:
2550
- return cls(pipeline_response, deserialized, {})
2602
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2551
2603
 
2552
- return deserialized
2604
+ return deserialized # type: ignore
2553
2605
 
2554
2606
  @overload
2555
2607
  def summary(
@@ -2575,14 +2627,14 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2575
2627
 
2576
2628
  @overload
2577
2629
  def summary(
2578
- self, body: IO, *, content_type: str = "application/json", **kwargs: Any
2630
+ self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
2579
2631
  ) -> Any:
2580
2632
  """Summary.
2581
2633
 
2582
2634
  Show information suitable for plotting.
2583
2635
 
2584
2636
  :param body: Required.
2585
- :type body: IO
2637
+ :type body: IO[bytes]
2586
2638
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
2587
2639
  Default value is "application/json".
2588
2640
  :paramtype content_type: str
@@ -2592,16 +2644,15 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2592
2644
  """
2593
2645
 
2594
2646
  @distributed_trace
2595
- 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:
2596
2650
  """Summary.
2597
2651
 
2598
2652
  Show information suitable for plotting.
2599
2653
 
2600
- :param body: Is either a JobSummaryParams type or a IO type. Required.
2601
- :type body: ~client.models.JobSummaryParams or IO
2602
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
2603
- Default value is None.
2604
- :paramtype content_type: str
2654
+ :param body: Is either a JobSummaryParams type or a IO[bytes] type. Required.
2655
+ :type body: ~client.models.JobSummaryParams or IO[bytes]
2605
2656
  :return: any
2606
2657
  :rtype: any
2607
2658
  :raises ~azure.core.exceptions.HttpResponseError:
@@ -2630,25 +2681,27 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2630
2681
  else:
2631
2682
  _json = self._serialize.body(body, "JobSummaryParams")
2632
2683
 
2633
- request = build_jobs_summary_request(
2684
+ _request = build_jobs_summary_request(
2634
2685
  content_type=content_type,
2635
2686
  json=_json,
2636
2687
  content=_content,
2637
2688
  headers=_headers,
2638
2689
  params=_params,
2639
2690
  )
2640
- request.url = self._client.format_url(request.url)
2691
+ _request.url = self._client.format_url(_request.url)
2641
2692
 
2642
2693
  _stream = False
2643
2694
  pipeline_response: PipelineResponse = (
2644
2695
  self._client._pipeline.run( # pylint: disable=protected-access
2645
- request, stream=_stream, **kwargs
2696
+ _request, stream=_stream, **kwargs
2646
2697
  )
2647
2698
  )
2648
2699
 
2649
2700
  response = pipeline_response.http_response
2650
2701
 
2651
2702
  if response.status_code not in [200]:
2703
+ if _stream:
2704
+ response.read() # Load the body in memory and close the socket
2652
2705
  map_error(
2653
2706
  status_code=response.status_code, response=response, error_map=error_map
2654
2707
  )
@@ -2657,9 +2710,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2657
2710
  deserialized = self._deserialize("object", pipeline_response)
2658
2711
 
2659
2712
  if cls:
2660
- return cls(pipeline_response, deserialized, {})
2713
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2661
2714
 
2662
- return deserialized
2715
+ return deserialized # type: ignore
2663
2716
 
2664
2717
  @distributed_trace
2665
2718
  def get_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2686,23 +2739,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2686
2739
 
2687
2740
  cls: ClsType[Any] = kwargs.pop("cls", None)
2688
2741
 
2689
- request = build_jobs_get_single_job_request(
2742
+ _request = build_jobs_get_single_job_request(
2690
2743
  job_id=job_id,
2691
2744
  headers=_headers,
2692
2745
  params=_params,
2693
2746
  )
2694
- request.url = self._client.format_url(request.url)
2747
+ _request.url = self._client.format_url(_request.url)
2695
2748
 
2696
2749
  _stream = False
2697
2750
  pipeline_response: PipelineResponse = (
2698
2751
  self._client._pipeline.run( # pylint: disable=protected-access
2699
- request, stream=_stream, **kwargs
2752
+ _request, stream=_stream, **kwargs
2700
2753
  )
2701
2754
  )
2702
2755
 
2703
2756
  response = pipeline_response.http_response
2704
2757
 
2705
2758
  if response.status_code not in [200]:
2759
+ if _stream:
2760
+ response.read() # Load the body in memory and close the socket
2706
2761
  map_error(
2707
2762
  status_code=response.status_code, response=response, error_map=error_map
2708
2763
  )
@@ -2711,9 +2766,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2711
2766
  deserialized = self._deserialize("object", pipeline_response)
2712
2767
 
2713
2768
  if cls:
2714
- return cls(pipeline_response, deserialized, {})
2769
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2715
2770
 
2716
- return deserialized
2771
+ return deserialized # type: ignore
2717
2772
 
2718
2773
  @distributed_trace
2719
2774
  def delete_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2740,23 +2795,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2740
2795
 
2741
2796
  cls: ClsType[Any] = kwargs.pop("cls", None)
2742
2797
 
2743
- request = build_jobs_delete_single_job_request(
2798
+ _request = build_jobs_delete_single_job_request(
2744
2799
  job_id=job_id,
2745
2800
  headers=_headers,
2746
2801
  params=_params,
2747
2802
  )
2748
- request.url = self._client.format_url(request.url)
2803
+ _request.url = self._client.format_url(_request.url)
2749
2804
 
2750
2805
  _stream = False
2751
2806
  pipeline_response: PipelineResponse = (
2752
2807
  self._client._pipeline.run( # pylint: disable=protected-access
2753
- request, stream=_stream, **kwargs
2808
+ _request, stream=_stream, **kwargs
2754
2809
  )
2755
2810
  )
2756
2811
 
2757
2812
  response = pipeline_response.http_response
2758
2813
 
2759
2814
  if response.status_code not in [200]:
2815
+ if _stream:
2816
+ response.read() # Load the body in memory and close the socket
2760
2817
  map_error(
2761
2818
  status_code=response.status_code, response=response, error_map=error_map
2762
2819
  )
@@ -2765,9 +2822,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2765
2822
  deserialized = self._deserialize("object", pipeline_response)
2766
2823
 
2767
2824
  if cls:
2768
- return cls(pipeline_response, deserialized, {})
2825
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2769
2826
 
2770
- return deserialized
2827
+ return deserialized # type: ignore
2771
2828
 
2772
2829
  @distributed_trace
2773
2830
  def set_single_job_properties(
@@ -2805,7 +2862,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2805
2862
 
2806
2863
  _json = self._serialize.body(body, "object")
2807
2864
 
2808
- request = build_jobs_set_single_job_properties_request(
2865
+ _request = build_jobs_set_single_job_properties_request(
2809
2866
  job_id=job_id,
2810
2867
  update_timestamp=update_timestamp,
2811
2868
  content_type=content_type,
@@ -2813,18 +2870,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2813
2870
  headers=_headers,
2814
2871
  params=_params,
2815
2872
  )
2816
- request.url = self._client.format_url(request.url)
2873
+ _request.url = self._client.format_url(_request.url)
2817
2874
 
2818
2875
  _stream = False
2819
2876
  pipeline_response: PipelineResponse = (
2820
2877
  self._client._pipeline.run( # pylint: disable=protected-access
2821
- request, stream=_stream, **kwargs
2878
+ _request, stream=_stream, **kwargs
2822
2879
  )
2823
2880
  )
2824
2881
 
2825
2882
  response = pipeline_response.http_response
2826
2883
 
2827
2884
  if response.status_code not in [200]:
2885
+ if _stream:
2886
+ response.read() # Load the body in memory and close the socket
2828
2887
  map_error(
2829
2888
  status_code=response.status_code, response=response, error_map=error_map
2830
2889
  )
@@ -2833,9 +2892,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2833
2892
  deserialized = self._deserialize("object", pipeline_response)
2834
2893
 
2835
2894
  if cls:
2836
- return cls(pipeline_response, deserialized, {})
2895
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2837
2896
 
2838
- return deserialized
2897
+ return deserialized # type: ignore
2839
2898
 
2840
2899
  @distributed_trace
2841
2900
  def kill_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2862,23 +2921,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2862
2921
 
2863
2922
  cls: ClsType[Any] = kwargs.pop("cls", None)
2864
2923
 
2865
- request = build_jobs_kill_single_job_request(
2924
+ _request = build_jobs_kill_single_job_request(
2866
2925
  job_id=job_id,
2867
2926
  headers=_headers,
2868
2927
  params=_params,
2869
2928
  )
2870
- request.url = self._client.format_url(request.url)
2929
+ _request.url = self._client.format_url(_request.url)
2871
2930
 
2872
2931
  _stream = False
2873
2932
  pipeline_response: PipelineResponse = (
2874
2933
  self._client._pipeline.run( # pylint: disable=protected-access
2875
- request, stream=_stream, **kwargs
2934
+ _request, stream=_stream, **kwargs
2876
2935
  )
2877
2936
  )
2878
2937
 
2879
2938
  response = pipeline_response.http_response
2880
2939
 
2881
2940
  if response.status_code not in [200]:
2941
+ if _stream:
2942
+ response.read() # Load the body in memory and close the socket
2882
2943
  map_error(
2883
2944
  status_code=response.status_code, response=response, error_map=error_map
2884
2945
  )
@@ -2887,9 +2948,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2887
2948
  deserialized = self._deserialize("object", pipeline_response)
2888
2949
 
2889
2950
  if cls:
2890
- return cls(pipeline_response, deserialized, {})
2951
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2891
2952
 
2892
- return deserialized
2953
+ return deserialized # type: ignore
2893
2954
 
2894
2955
  @distributed_trace
2895
2956
  def remove_single_job(self, job_id: int, **kwargs: Any) -> Any:
@@ -2920,23 +2981,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2920
2981
 
2921
2982
  cls: ClsType[Any] = kwargs.pop("cls", None)
2922
2983
 
2923
- request = build_jobs_remove_single_job_request(
2984
+ _request = build_jobs_remove_single_job_request(
2924
2985
  job_id=job_id,
2925
2986
  headers=_headers,
2926
2987
  params=_params,
2927
2988
  )
2928
- request.url = self._client.format_url(request.url)
2989
+ _request.url = self._client.format_url(_request.url)
2929
2990
 
2930
2991
  _stream = False
2931
2992
  pipeline_response: PipelineResponse = (
2932
2993
  self._client._pipeline.run( # pylint: disable=protected-access
2933
- request, stream=_stream, **kwargs
2994
+ _request, stream=_stream, **kwargs
2934
2995
  )
2935
2996
  )
2936
2997
 
2937
2998
  response = pipeline_response.http_response
2938
2999
 
2939
3000
  if response.status_code not in [200]:
3001
+ if _stream:
3002
+ response.read() # Load the body in memory and close the socket
2940
3003
  map_error(
2941
3004
  status_code=response.status_code, response=response, error_map=error_map
2942
3005
  )
@@ -2945,9 +3008,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2945
3008
  deserialized = self._deserialize("object", pipeline_response)
2946
3009
 
2947
3010
  if cls:
2948
- return cls(pipeline_response, deserialized, {})
3011
+ return cls(pipeline_response, deserialized, {}) # type: ignore
2949
3012
 
2950
- return deserialized
3013
+ return deserialized # type: ignore
2951
3014
 
2952
3015
  @distributed_trace
2953
3016
  def get_single_job_status(
@@ -2978,23 +3041,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
2978
3041
  "cls", None
2979
3042
  )
2980
3043
 
2981
- request = build_jobs_get_single_job_status_request(
3044
+ _request = build_jobs_get_single_job_status_request(
2982
3045
  job_id=job_id,
2983
3046
  headers=_headers,
2984
3047
  params=_params,
2985
3048
  )
2986
- request.url = self._client.format_url(request.url)
3049
+ _request.url = self._client.format_url(_request.url)
2987
3050
 
2988
3051
  _stream = False
2989
3052
  pipeline_response: PipelineResponse = (
2990
3053
  self._client._pipeline.run( # pylint: disable=protected-access
2991
- request, stream=_stream, **kwargs
3054
+ _request, stream=_stream, **kwargs
2992
3055
  )
2993
3056
  )
2994
3057
 
2995
3058
  response = pipeline_response.http_response
2996
3059
 
2997
3060
  if response.status_code not in [200]:
3061
+ if _stream:
3062
+ response.read() # Load the body in memory and close the socket
2998
3063
  map_error(
2999
3064
  status_code=response.status_code, response=response, error_map=error_map
3000
3065
  )
@@ -3003,9 +3068,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3003
3068
  deserialized = self._deserialize("{LimitedJobStatusReturn}", pipeline_response)
3004
3069
 
3005
3070
  if cls:
3006
- return cls(pipeline_response, deserialized, {})
3071
+ return cls(pipeline_response, deserialized, {}) # type: ignore
3007
3072
 
3008
- return deserialized
3073
+ return deserialized # type: ignore
3009
3074
 
3010
3075
  @overload
3011
3076
  def set_single_job_status(
@@ -3039,7 +3104,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3039
3104
  def set_single_job_status(
3040
3105
  self,
3041
3106
  job_id: int,
3042
- body: IO,
3107
+ body: IO[bytes],
3043
3108
  *,
3044
3109
  force: bool = False,
3045
3110
  content_type: str = "application/json",
@@ -3052,7 +3117,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3052
3117
  :param job_id: Required.
3053
3118
  :type job_id: int
3054
3119
  :param body: Required.
3055
- :type body: IO
3120
+ :type body: IO[bytes]
3056
3121
  :keyword force: Default value is False.
3057
3122
  :paramtype force: bool
3058
3123
  :keyword content_type: Body Parameter content-type. Content type parameter for binary body.
@@ -3067,7 +3132,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3067
3132
  def set_single_job_status(
3068
3133
  self,
3069
3134
  job_id: int,
3070
- body: Union[Dict[str, _models.JobStatusUpdate], IO],
3135
+ body: Union[Dict[str, _models.JobStatusUpdate], IO[bytes]],
3071
3136
  *,
3072
3137
  force: bool = False,
3073
3138
  **kwargs: Any,
@@ -3078,13 +3143,10 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3078
3143
 
3079
3144
  :param job_id: Required.
3080
3145
  :type job_id: int
3081
- :param body: Is either a {str: JobStatusUpdate} type or a IO type. Required.
3082
- :type body: dict[str, ~client.models.JobStatusUpdate] or IO
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]
3083
3148
  :keyword force: Default value is False.
3084
3149
  :paramtype force: bool
3085
- :keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
3086
- Default value is None.
3087
- :paramtype content_type: str
3088
3150
  :return: dict mapping str to SetJobStatusReturn
3089
3151
  :rtype: dict[str, ~client.models.SetJobStatusReturn]
3090
3152
  :raises ~azure.core.exceptions.HttpResponseError:
@@ -3113,7 +3175,7 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3113
3175
  else:
3114
3176
  _json = self._serialize.body(body, "{JobStatusUpdate}")
3115
3177
 
3116
- request = build_jobs_set_single_job_status_request(
3178
+ _request = build_jobs_set_single_job_status_request(
3117
3179
  job_id=job_id,
3118
3180
  force=force,
3119
3181
  content_type=content_type,
@@ -3122,18 +3184,20 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3122
3184
  headers=_headers,
3123
3185
  params=_params,
3124
3186
  )
3125
- request.url = self._client.format_url(request.url)
3187
+ _request.url = self._client.format_url(_request.url)
3126
3188
 
3127
3189
  _stream = False
3128
3190
  pipeline_response: PipelineResponse = (
3129
3191
  self._client._pipeline.run( # pylint: disable=protected-access
3130
- request, stream=_stream, **kwargs
3192
+ _request, stream=_stream, **kwargs
3131
3193
  )
3132
3194
  )
3133
3195
 
3134
3196
  response = pipeline_response.http_response
3135
3197
 
3136
3198
  if response.status_code not in [200]:
3199
+ if _stream:
3200
+ response.read() # Load the body in memory and close the socket
3137
3201
  map_error(
3138
3202
  status_code=response.status_code, response=response, error_map=error_map
3139
3203
  )
@@ -3142,9 +3206,9 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3142
3206
  deserialized = self._deserialize("{SetJobStatusReturn}", pipeline_response)
3143
3207
 
3144
3208
  if cls:
3145
- return cls(pipeline_response, deserialized, {})
3209
+ return cls(pipeline_response, deserialized, {}) # type: ignore
3146
3210
 
3147
- return deserialized
3211
+ return deserialized # type: ignore
3148
3212
 
3149
3213
  @distributed_trace
3150
3214
  def get_single_job_status_history(
@@ -3173,23 +3237,25 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3173
3237
 
3174
3238
  cls: ClsType[Dict[str, List[_models.JobStatusReturn]]] = kwargs.pop("cls", None)
3175
3239
 
3176
- request = build_jobs_get_single_job_status_history_request(
3240
+ _request = build_jobs_get_single_job_status_history_request(
3177
3241
  job_id=job_id,
3178
3242
  headers=_headers,
3179
3243
  params=_params,
3180
3244
  )
3181
- request.url = self._client.format_url(request.url)
3245
+ _request.url = self._client.format_url(_request.url)
3182
3246
 
3183
3247
  _stream = False
3184
3248
  pipeline_response: PipelineResponse = (
3185
3249
  self._client._pipeline.run( # pylint: disable=protected-access
3186
- request, stream=_stream, **kwargs
3250
+ _request, stream=_stream, **kwargs
3187
3251
  )
3188
3252
  )
3189
3253
 
3190
3254
  response = pipeline_response.http_response
3191
3255
 
3192
3256
  if response.status_code not in [200]:
3257
+ if _stream:
3258
+ response.read() # Load the body in memory and close the socket
3193
3259
  map_error(
3194
3260
  status_code=response.status_code, response=response, error_map=error_map
3195
3261
  )
@@ -3198,6 +3264,6 @@ class JobsOperations: # pylint: disable=too-many-public-methods
3198
3264
  deserialized = self._deserialize("{[JobStatusReturn]}", pipeline_response)
3199
3265
 
3200
3266
  if cls:
3201
- return cls(pipeline_response, deserialized, {})
3267
+ return cls(pipeline_response, deserialized, {}) # type: ignore
3202
3268
 
3203
- return deserialized
3269
+ return deserialized # type: ignore