6
6
# Code generated by Microsoft (R) Python Code Generator.
7
7
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
8
# --------------------------------------------------------------------------
9
+ from collections .abc import MutableMapping
9
10
from io import IOBase
10
11
import json
11
- import sys
12
12
from typing import Any , AsyncIterable , Callable , Dict , IO , List , Optional , TypeVar , Union , overload
13
13
import urllib .parse
14
14
49
49
build_deployments_list_request ,
50
50
build_evaluation_results_create_version_request ,
51
51
build_evaluation_results_delete_version_request ,
52
- build_evaluation_results_fetch_asset_credentials_request ,
52
+ build_evaluation_results_get_credentials_request ,
53
53
build_evaluation_results_get_version_request ,
54
54
build_evaluation_results_list_latest_request ,
55
55
build_evaluation_results_list_versions_request ,
58
58
build_evaluations_create_run_request ,
59
59
build_evaluations_get_request ,
60
60
build_evaluations_list_request ,
61
+ build_evaluations_operation_results_request ,
61
62
build_evaluations_submit_annotation_request ,
62
63
build_evaluations_upload_run_request ,
63
64
build_evaluations_upload_update_run_request ,
81
82
)
82
83
from .._configuration import AIProjectClientConfiguration
83
84
84
- if sys .version_info >= (3 , 9 ):
85
- from collections .abc import MutableMapping
86
- else :
87
- from typing import MutableMapping # type: ignore
88
85
T = TypeVar ("T" )
89
86
ClsType = Optional [Callable [[PipelineResponse [HttpRequest , AsyncHttpResponse ], T , Dict [str , Any ]], Any ]]
90
- JSON = MutableMapping [str , Any ] # pylint: disable=unsubscriptable-object
87
+ JSON = MutableMapping [str , Any ]
91
88
92
89
93
90
class ServicePatternsOperations :
@@ -883,6 +880,70 @@ async def submit_annotation(
883
880
884
881
return deserialized # type: ignore
885
882
883
+ @distributed_trace_async
884
+ @api_version_validation (
885
+ method_added_on = "2025-05-15-preview" ,
886
+ params_added_on = {"2025-05-15-preview" : ["api_version" , "operation_id" , "accept" ]},
887
+ )
888
+ async def operation_results (self , operation_id : str , ** kwargs : Any ) -> Dict [str , Any ]:
889
+ """Poll for the operation results.
890
+
891
+ :param operation_id: Operation ID for the polling operation. Required.
892
+ :type operation_id: str
893
+ :return: dict mapping str to any
894
+ :rtype: dict[str, any]
895
+ :raises ~azure.core.exceptions.HttpResponseError:
896
+ """
897
+ error_map : MutableMapping = {
898
+ 401 : ClientAuthenticationError ,
899
+ 404 : ResourceNotFoundError ,
900
+ 409 : ResourceExistsError ,
901
+ 304 : ResourceNotModifiedError ,
902
+ }
903
+ error_map .update (kwargs .pop ("error_map" , {}) or {})
904
+
905
+ _headers = kwargs .pop ("headers" , {}) or {}
906
+ _params = kwargs .pop ("params" , {}) or {}
907
+
908
+ cls : ClsType [Dict [str , Any ]] = kwargs .pop ("cls" , None )
909
+
910
+ _request = build_evaluations_operation_results_request (
911
+ operation_id = operation_id ,
912
+ api_version = self ._config .api_version ,
913
+ headers = _headers ,
914
+ params = _params ,
915
+ )
916
+ path_format_arguments = {
917
+ "endpoint" : self ._serialize .url ("self._config.endpoint" , self ._config .endpoint , "str" , skip_quote = True ),
918
+ }
919
+ _request .url = self ._client .format_url (_request .url , ** path_format_arguments )
920
+
921
+ _stream = kwargs .pop ("stream" , False )
922
+ pipeline_response : PipelineResponse = await self ._client ._pipeline .run ( # pylint: disable=protected-access
923
+ _request , stream = _stream , ** kwargs
924
+ )
925
+
926
+ response = pipeline_response .http_response
927
+
928
+ if response .status_code not in [202 ]:
929
+ if _stream :
930
+ try :
931
+ await response .read () # Load the body in memory and close the socket
932
+ except (StreamConsumedError , StreamClosedError ):
933
+ pass
934
+ map_error (status_code = response .status_code , response = response , error_map = error_map )
935
+ raise HttpResponseError (response = response )
936
+
937
+ if _stream :
938
+ deserialized = response .iter_bytes ()
939
+ else :
940
+ deserialized = _deserialize (Dict [str , Any ], response .json ())
941
+
942
+ if cls :
943
+ return cls (pipeline_response , deserialized , {}) # type: ignore
944
+
945
+ return deserialized # type: ignore
946
+
886
947
@overload
887
948
async def upload_run (
888
949
self , evaluation : _models .EvaluationUpload , * , content_type : str = "application/json" , ** kwargs : Any
@@ -4267,7 +4328,7 @@ async def start_pending_upload(
4267
4328
return deserialized # type: ignore
4268
4329
4269
4330
@overload
4270
- async def fetch_asset_credentials (
4331
+ async def get_credentials (
4271
4332
self ,
4272
4333
name : str ,
4273
4334
version : str ,
@@ -4293,7 +4354,7 @@ async def fetch_asset_credentials(
4293
4354
"""
4294
4355
4295
4356
@overload
4296
- async def fetch_asset_credentials (
4357
+ async def get_credentials (
4297
4358
self , name : str , version : str , body : JSON , * , content_type : str = "application/json" , ** kwargs : Any
4298
4359
) -> _models .AssetCredentialResponse :
4299
4360
"""Enable downloading json.
@@ -4313,7 +4374,7 @@ async def fetch_asset_credentials(
4313
4374
"""
4314
4375
4315
4376
@overload
4316
- async def fetch_asset_credentials (
4377
+ async def get_credentials (
4317
4378
self , name : str , version : str , body : IO [bytes ], * , content_type : str = "application/json" , ** kwargs : Any
4318
4379
) -> _models .AssetCredentialResponse :
4319
4380
"""Enable downloading json.
@@ -4337,7 +4398,7 @@ async def fetch_asset_credentials(
4337
4398
method_added_on = "2025-05-15-preview" ,
4338
4399
params_added_on = {"2025-05-15-preview" : ["api_version" , "name" , "version" , "content_type" , "accept" ]},
4339
4400
)
4340
- async def fetch_asset_credentials (
4401
+ async def get_credentials (
4341
4402
self , name : str , version : str , body : Union [_models .AssetCredentialRequest , JSON , IO [bytes ]], ** kwargs : Any
4342
4403
) -> _models .AssetCredentialResponse :
4343
4404
"""Enable downloading json.
@@ -4374,7 +4435,7 @@ async def fetch_asset_credentials(
4374
4435
else :
4375
4436
_content = json .dumps (body , cls = SdkJSONEncoder , exclude_readonly = True ) # type: ignore
4376
4437
4377
- _request = build_evaluation_results_fetch_asset_credentials_request (
4438
+ _request = build_evaluation_results_get_credentials_request (
4378
4439
name = name ,
4379
4440
version = version ,
4380
4441
content_type = content_type ,
0 commit comments