66# Code generated by Microsoft (R) Python Code Generator.
77# Changes may cause incorrect behavior and will be lost if the code is regenerated.
88# --------------------------------------------------------------------------
9+ from collections .abc import MutableMapping
910import datetime
1011from io import IOBase
1112import json
12- import sys
1313from typing import Any , Callable , Dict , IO , Iterable , List , Optional , TypeVar , Union , overload
1414import urllib .parse
1515
16+ from azure .core import PipelineClient
1617from azure .core .exceptions import (
1718 ClientAuthenticationError ,
1819 HttpResponseError ,
3031from azure .core .utils import case_insensitive_dict
3132
3233from .. import models as _models
33- from .._model_base import SdkJSONEncoder , _deserialize
34- from .._serialization import Serializer
34+ from .._configuration import LoadTestAdministrationClientConfiguration , LoadTestRunClientConfiguration
35+ from .._utils .model_base import SdkJSONEncoder , _deserialize
36+ from .._utils .serialization import Serializer
37+ from .._utils .utils import ClientMixinABC
3538from .._validation import api_version_validation
36- from .._vendor import LoadTestAdministrationClientMixinABC , LoadTestRunClientMixinABC
3739
38- if sys .version_info >= (3 , 9 ):
39- from collections .abc import MutableMapping
40- else :
41- from typing import MutableMapping # type: ignore
42- JSON = MutableMapping [str , Any ] # pylint: disable=unsubscriptable-object
40+ JSON = MutableMapping [str , Any ]
4341T = TypeVar ("T" )
4442ClsType = Optional [Callable [[PipelineResponse [HttpRequest , HttpResponse ], T , Dict [str , Any ]], Any ]]
4543
@@ -870,6 +868,7 @@ def build_load_test_run_list_test_runs_request( # pylint: disable=name-too-long
870868 execution_to : Optional [datetime .datetime ] = None ,
871869 status : Optional [str ] = None ,
872870 maxpagesize : Optional [int ] = None ,
871+ created_by_types : Optional [List [str ]] = None ,
873872 ** kwargs : Any
874873) -> HttpRequest :
875874 _headers = case_insensitive_dict (kwargs .pop ("headers" , {}) or {})
@@ -897,6 +896,8 @@ def build_load_test_run_list_test_runs_request( # pylint: disable=name-too-long
897896 _params ["status" ] = _SERIALIZER .query ("status" , status , "str" )
898897 if maxpagesize is not None :
899898 _params ["maxpagesize" ] = _SERIALIZER .query ("maxpagesize" , maxpagesize , "int" )
899+ if created_by_types is not None :
900+ _params ["createdByTypes" ] = _SERIALIZER .query ("created_by_types" , created_by_types , "[str]" , div = "," )
900901
901902 # Construct headers
902903 _headers ["Accept" ] = _SERIALIZER .header ("accept" , accept , "str" )
@@ -1092,7 +1093,7 @@ def build_load_test_run_stop_test_profile_run_request( # pylint: disable=name-t
10921093
10931094
10941095class LoadTestAdministrationClientOperationsMixin ( # pylint: disable=name-too-long
1095- LoadTestAdministrationClientMixinABC
1096+ ClientMixinABC [ PipelineClient , LoadTestAdministrationClientConfiguration ]
10961097):
10971098
10981099 @overload
@@ -1851,7 +1852,7 @@ def prepare_request(next_link=None):
18511852
18521853 def extract_data (pipeline_response ):
18531854 deserialized = pipeline_response .http_response .json ()
1854- list_of_elem = _deserialize (List [_models .TestFileInfo ], deserialized [ "value" ] )
1855+ list_of_elem = _deserialize (List [_models .TestFileInfo ], deserialized . get ( "value" , []) )
18551856 if cls :
18561857 list_of_elem = cls (list_of_elem ) # type: ignore
18571858 return deserialized .get ("nextLink" ) or None , iter (list_of_elem )
@@ -1960,7 +1961,7 @@ def prepare_request(next_link=None):
19601961
19611962 def extract_data (pipeline_response ):
19621963 deserialized = pipeline_response .http_response .json ()
1963- list_of_elem = _deserialize (List [_models .Test ], deserialized [ "value" ] )
1964+ list_of_elem = _deserialize (List [_models .Test ], deserialized . get ( "value" , []) )
19641965 if cls :
19651966 list_of_elem = cls (list_of_elem ) # type: ignore
19661967 return deserialized .get ("nextLink" ) or None , iter (list_of_elem )
@@ -2556,7 +2557,7 @@ def prepare_request(next_link=None):
25562557
25572558 def extract_data (pipeline_response ):
25582559 deserialized = pipeline_response .http_response .json ()
2559- list_of_elem = _deserialize (List [_models .TestProfile ], deserialized [ "value" ] )
2560+ list_of_elem = _deserialize (List [_models .TestProfile ], deserialized . get ( "value" , []) )
25602561 if cls :
25612562 list_of_elem = cls (list_of_elem ) # type: ignore
25622563 return deserialized .get ("nextLink" ) or None , iter (list_of_elem )
@@ -2579,7 +2580,7 @@ def get_next(next_link=None):
25792580 return ItemPaged (get_next , extract_data )
25802581
25812582
2582- class LoadTestRunClientOperationsMixin (LoadTestRunClientMixinABC ):
2583+ class LoadTestRunClientOperationsMixin (ClientMixinABC [ PipelineClient , LoadTestRunClientConfiguration ] ):
25832584
25842585 @overload
25852586 def _begin_test_run (
@@ -3399,7 +3400,7 @@ def prepare_request(next_link=None):
33993400
34003401 def extract_data (pipeline_response ):
34013402 deserialized = pipeline_response .http_response .json ()
3402- list_of_elem = _deserialize (List [str ], deserialized [ "value" ] )
3403+ list_of_elem = _deserialize (List [str ], deserialized . get ( "value" , []) )
34033404 if cls :
34043405 list_of_elem = cls (list_of_elem ) # type: ignore
34053406 return deserialized .get ("nextLink" ) or None , iter (list_of_elem )
@@ -3788,7 +3789,7 @@ def prepare_request(next_link=None):
37883789
37893790 def extract_data (pipeline_response ):
37903791 deserialized = pipeline_response .http_response .json ()
3791- list_of_elem = _deserialize (List [_models .TimeSeriesElement ], deserialized [ "value" ] )
3792+ list_of_elem = _deserialize (List [_models .TimeSeriesElement ], deserialized . get ( "value" , []) )
37923793 if cls :
37933794 list_of_elem = cls (list_of_elem ) # type: ignore
37943795 return deserialized .get ("nextLink" ) or None , iter (list_of_elem )
@@ -3811,6 +3812,9 @@ def get_next(next_link=None):
38113812 return ItemPaged (get_next , extract_data )
38123813
38133814 @distributed_trace
3815+ @api_version_validation (
3816+ params_added_on = {"2024-07-01-preview" : ["created_by_types" ]},
3817+ )
38143818 def list_test_runs (
38153819 self ,
38163820 * ,
@@ -3820,6 +3824,7 @@ def list_test_runs(
38203824 execution_from : Optional [datetime .datetime ] = None ,
38213825 execution_to : Optional [datetime .datetime ] = None ,
38223826 status : Optional [str ] = None ,
3827+ created_by_types : Optional [List [str ]] = None ,
38233828 ** kwargs : Any
38243829 ) -> Iterable ["_models.TestRun" ]:
38253830 """Get all test runs for the given filters.
@@ -3843,6 +3848,9 @@ def list_test_runs(
38433848 :paramtype execution_to: ~datetime.datetime
38443849 :keyword status: Comma separated list of test run status. Default value is None.
38453850 :paramtype status: str
3851+ :keyword created_by_types: Comma separated list of type of entities that have created the test
3852+ run. Default value is None.
3853+ :paramtype created_by_types: list[str]
38463854 :return: An iterator like instance of TestRun
38473855 :rtype: ~azure.core.paging.ItemPaged[~azure.developer.loadtesting.models.TestRun]
38483856 :raises ~azure.core.exceptions.HttpResponseError:
@@ -3872,6 +3880,7 @@ def prepare_request(next_link=None):
38723880 execution_to = execution_to ,
38733881 status = status ,
38743882 maxpagesize = maxpagesize ,
3883+ created_by_types = created_by_types ,
38753884 api_version = self ._config .api_version ,
38763885 headers = _headers ,
38773886 params = _params ,
@@ -3903,7 +3912,7 @@ def prepare_request(next_link=None):
39033912
39043913 def extract_data (pipeline_response ):
39053914 deserialized = pipeline_response .http_response .json ()
3906- list_of_elem = _deserialize (List [_models .TestRun ], deserialized [ "value" ] )
3915+ list_of_elem = _deserialize (List [_models .TestRun ], deserialized . get ( "value" , []) )
39073916 if cls :
39083917 list_of_elem = cls (list_of_elem ) # type: ignore
39093918 return deserialized .get ("nextLink" ) or None , iter (list_of_elem )
@@ -4345,7 +4354,7 @@ def prepare_request(next_link=None):
43454354
43464355 def extract_data (pipeline_response ):
43474356 deserialized = pipeline_response .http_response .json ()
4348- list_of_elem = _deserialize (List [_models .TestProfileRun ], deserialized [ "value" ] )
4357+ list_of_elem = _deserialize (List [_models .TestProfileRun ], deserialized . get ( "value" , []) )
43494358 if cls :
43504359 list_of_elem = cls (list_of_elem ) # type: ignore
43514360 return deserialized .get ("nextLink" ) or None , iter (list_of_elem )
0 commit comments