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
import datetime
10
11
from io import IOBase
11
12
import json
12
- import sys
13
13
from typing import Any , Callable , Dict , IO , Iterable , List , Optional , TypeVar , Union , overload
14
14
import urllib .parse
15
15
16
+ from azure .core import PipelineClient
16
17
from azure .core .exceptions import (
17
18
ClientAuthenticationError ,
18
19
HttpResponseError ,
30
31
from azure .core .utils import case_insensitive_dict
31
32
32
33
from .. 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
35
38
from .._validation import api_version_validation
36
- from .._vendor import LoadTestAdministrationClientMixinABC , LoadTestRunClientMixinABC
37
39
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 ]
43
41
T = TypeVar ("T" )
44
42
ClsType = Optional [Callable [[PipelineResponse [HttpRequest , HttpResponse ], T , Dict [str , Any ]], Any ]]
45
43
@@ -870,6 +868,7 @@ def build_load_test_run_list_test_runs_request( # pylint: disable=name-too-long
870
868
execution_to : Optional [datetime .datetime ] = None ,
871
869
status : Optional [str ] = None ,
872
870
maxpagesize : Optional [int ] = None ,
871
+ created_by_types : Optional [List [str ]] = None ,
873
872
** kwargs : Any
874
873
) -> HttpRequest :
875
874
_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
897
896
_params ["status" ] = _SERIALIZER .query ("status" , status , "str" )
898
897
if maxpagesize is not None :
899
898
_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 = "," )
900
901
901
902
# Construct headers
902
903
_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
1092
1093
1093
1094
1094
1095
class LoadTestAdministrationClientOperationsMixin ( # pylint: disable=name-too-long
1095
- LoadTestAdministrationClientMixinABC
1096
+ ClientMixinABC [ PipelineClient , LoadTestAdministrationClientConfiguration ]
1096
1097
):
1097
1098
1098
1099
@overload
@@ -1851,7 +1852,7 @@ def prepare_request(next_link=None):
1851
1852
1852
1853
def extract_data (pipeline_response ):
1853
1854
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" , []) )
1855
1856
if cls :
1856
1857
list_of_elem = cls (list_of_elem ) # type: ignore
1857
1858
return deserialized .get ("nextLink" ) or None , iter (list_of_elem )
@@ -1960,7 +1961,7 @@ def prepare_request(next_link=None):
1960
1961
1961
1962
def extract_data (pipeline_response ):
1962
1963
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" , []) )
1964
1965
if cls :
1965
1966
list_of_elem = cls (list_of_elem ) # type: ignore
1966
1967
return deserialized .get ("nextLink" ) or None , iter (list_of_elem )
@@ -2556,7 +2557,7 @@ def prepare_request(next_link=None):
2556
2557
2557
2558
def extract_data (pipeline_response ):
2558
2559
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" , []) )
2560
2561
if cls :
2561
2562
list_of_elem = cls (list_of_elem ) # type: ignore
2562
2563
return deserialized .get ("nextLink" ) or None , iter (list_of_elem )
@@ -2579,7 +2580,7 @@ def get_next(next_link=None):
2579
2580
return ItemPaged (get_next , extract_data )
2580
2581
2581
2582
2582
- class LoadTestRunClientOperationsMixin (LoadTestRunClientMixinABC ):
2583
+ class LoadTestRunClientOperationsMixin (ClientMixinABC [ PipelineClient , LoadTestRunClientConfiguration ] ):
2583
2584
2584
2585
@overload
2585
2586
def _begin_test_run (
@@ -3399,7 +3400,7 @@ def prepare_request(next_link=None):
3399
3400
3400
3401
def extract_data (pipeline_response ):
3401
3402
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" , []) )
3403
3404
if cls :
3404
3405
list_of_elem = cls (list_of_elem ) # type: ignore
3405
3406
return deserialized .get ("nextLink" ) or None , iter (list_of_elem )
@@ -3788,7 +3789,7 @@ def prepare_request(next_link=None):
3788
3789
3789
3790
def extract_data (pipeline_response ):
3790
3791
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" , []) )
3792
3793
if cls :
3793
3794
list_of_elem = cls (list_of_elem ) # type: ignore
3794
3795
return deserialized .get ("nextLink" ) or None , iter (list_of_elem )
@@ -3811,6 +3812,9 @@ def get_next(next_link=None):
3811
3812
return ItemPaged (get_next , extract_data )
3812
3813
3813
3814
@distributed_trace
3815
+ @api_version_validation (
3816
+ params_added_on = {"2024-07-01-preview" : ["created_by_types" ]},
3817
+ )
3814
3818
def list_test_runs (
3815
3819
self ,
3816
3820
* ,
@@ -3820,6 +3824,7 @@ def list_test_runs(
3820
3824
execution_from : Optional [datetime .datetime ] = None ,
3821
3825
execution_to : Optional [datetime .datetime ] = None ,
3822
3826
status : Optional [str ] = None ,
3827
+ created_by_types : Optional [List [str ]] = None ,
3823
3828
** kwargs : Any
3824
3829
) -> Iterable ["_models.TestRun" ]:
3825
3830
"""Get all test runs for the given filters.
@@ -3843,6 +3848,9 @@ def list_test_runs(
3843
3848
:paramtype execution_to: ~datetime.datetime
3844
3849
:keyword status: Comma separated list of test run status. Default value is None.
3845
3850
: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]
3846
3854
:return: An iterator like instance of TestRun
3847
3855
:rtype: ~azure.core.paging.ItemPaged[~azure.developer.loadtesting.models.TestRun]
3848
3856
:raises ~azure.core.exceptions.HttpResponseError:
@@ -3872,6 +3880,7 @@ def prepare_request(next_link=None):
3872
3880
execution_to = execution_to ,
3873
3881
status = status ,
3874
3882
maxpagesize = maxpagesize ,
3883
+ created_by_types = created_by_types ,
3875
3884
api_version = self ._config .api_version ,
3876
3885
headers = _headers ,
3877
3886
params = _params ,
@@ -3903,7 +3912,7 @@ def prepare_request(next_link=None):
3903
3912
3904
3913
def extract_data (pipeline_response ):
3905
3914
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" , []) )
3907
3916
if cls :
3908
3917
list_of_elem = cls (list_of_elem ) # type: ignore
3909
3918
return deserialized .get ("nextLink" ) or None , iter (list_of_elem )
@@ -4345,7 +4354,7 @@ def prepare_request(next_link=None):
4345
4354
4346
4355
def extract_data (pipeline_response ):
4347
4356
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" , []) )
4349
4358
if cls :
4350
4359
list_of_elem = cls (list_of_elem ) # type: ignore
4351
4360
return deserialized .get ("nextLink" ) or None , iter (list_of_elem )
0 commit comments