1# -------------------------------------------------------------------------------------------- 2# Copyright (c) Microsoft Corporation. All rights reserved. 3# Licensed under the MIT License. See License.txt in the project root for license information. 4# -------------------------------------------------------------------------------------------- 5# Generated file, DO NOT EDIT 6# Changes may cause incorrect behavior and will be lost if the code is regenerated. 7# -------------------------------------------------------------------------------------------- 8 9from msrest import Serializer, Deserializer 10from ...vss_client import VssClient 11from . import models 12 13 14class CloudLoadTestClient(VssClient): 15 """CloudLoadTest 16 :param str base_url: Service URL 17 :param Authentication creds: Authenticated credentials. 18 """ 19 20 def __init__(self, base_url=None, creds=None): 21 super(CloudLoadTestClient, self).__init__(base_url, creds) 22 client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} 23 self._serialize = Serializer(client_models) 24 self._deserialize = Deserializer(client_models) 25 26 resource_area_identifier = '7ae6d0a6-cda5-44cf-a261-28c392bed25c' 27 28 def create_agent_group(self, group): 29 """CreateAgentGroup. 30 :param :class:`<AgentGroup> <cloud-load-test.v4_1.models.AgentGroup>` group: Agent group to be created 31 :rtype: :class:`<AgentGroup> <cloud-load-test.v4_1.models.AgentGroup>` 32 """ 33 content = self._serialize.body(group, 'AgentGroup') 34 response = self._send(http_method='POST', 35 location_id='ab8d91c1-12d9-4ec5-874d-1ddb23e17720', 36 version='4.1', 37 content=content) 38 return self._deserialize('AgentGroup', response) 39 40 def get_agent_groups(self, agent_group_id=None, machine_setup_input=None, machine_access_data=None, outgoing_request_urls=None, agent_group_name=None): 41 """GetAgentGroups. 42 :param str agent_group_id: The agent group indentifier 43 :param bool machine_setup_input: 44 :param bool machine_access_data: 45 :param bool outgoing_request_urls: 46 :param str agent_group_name: Name of the agent group 47 :rtype: object 48 """ 49 route_values = {} 50 if agent_group_id is not None: 51 route_values['agentGroupId'] = self._serialize.url('agent_group_id', agent_group_id, 'str') 52 query_parameters = {} 53 if machine_setup_input is not None: 54 query_parameters['machineSetupInput'] = self._serialize.query('machine_setup_input', machine_setup_input, 'bool') 55 if machine_access_data is not None: 56 query_parameters['machineAccessData'] = self._serialize.query('machine_access_data', machine_access_data, 'bool') 57 if outgoing_request_urls is not None: 58 query_parameters['outgoingRequestUrls'] = self._serialize.query('outgoing_request_urls', outgoing_request_urls, 'bool') 59 if agent_group_name is not None: 60 query_parameters['agentGroupName'] = self._serialize.query('agent_group_name', agent_group_name, 'str') 61 response = self._send(http_method='GET', 62 location_id='ab8d91c1-12d9-4ec5-874d-1ddb23e17720', 63 version='4.1', 64 route_values=route_values, 65 query_parameters=query_parameters) 66 return self._deserialize('object', response) 67 68 def delete_static_agent(self, agent_group_id, agent_name): 69 """DeleteStaticAgent. 70 :param str agent_group_id: The agent group identifier 71 :param str agent_name: Name of the static agent 72 :rtype: str 73 """ 74 route_values = {} 75 if agent_group_id is not None: 76 route_values['agentGroupId'] = self._serialize.url('agent_group_id', agent_group_id, 'str') 77 query_parameters = {} 78 if agent_name is not None: 79 query_parameters['agentName'] = self._serialize.query('agent_name', agent_name, 'str') 80 response = self._send(http_method='DELETE', 81 location_id='87e4b63d-7142-4b50-801e-72ba9ff8ee9b', 82 version='4.1', 83 route_values=route_values, 84 query_parameters=query_parameters) 85 return self._deserialize('str', response) 86 87 def get_static_agents(self, agent_group_id, agent_name=None): 88 """GetStaticAgents. 89 :param str agent_group_id: The agent group identifier 90 :param str agent_name: Name of the static agent 91 :rtype: object 92 """ 93 route_values = {} 94 if agent_group_id is not None: 95 route_values['agentGroupId'] = self._serialize.url('agent_group_id', agent_group_id, 'str') 96 query_parameters = {} 97 if agent_name is not None: 98 query_parameters['agentName'] = self._serialize.query('agent_name', agent_name, 'str') 99 response = self._send(http_method='GET', 100 location_id='87e4b63d-7142-4b50-801e-72ba9ff8ee9b', 101 version='4.1', 102 route_values=route_values, 103 query_parameters=query_parameters) 104 return self._deserialize('object', response) 105 106 def get_application(self, application_id): 107 """GetApplication. 108 :param str application_id: Filter by APM application identifier. 109 :rtype: :class:`<Application> <cloud-load-test.v4_1.models.Application>` 110 """ 111 route_values = {} 112 if application_id is not None: 113 route_values['applicationId'] = self._serialize.url('application_id', application_id, 'str') 114 response = self._send(http_method='GET', 115 location_id='2c986dce-8e8d-4142-b541-d016d5aff764', 116 version='4.1', 117 route_values=route_values) 118 return self._deserialize('Application', response) 119 120 def get_applications(self, type=None): 121 """GetApplications. 122 :param str type: Filters the results based on the plugin type. 123 :rtype: [Application] 124 """ 125 query_parameters = {} 126 if type is not None: 127 query_parameters['type'] = self._serialize.query('type', type, 'str') 128 response = self._send(http_method='GET', 129 location_id='2c986dce-8e8d-4142-b541-d016d5aff764', 130 version='4.1', 131 query_parameters=query_parameters) 132 return self._deserialize('[Application]', self._unwrap_collection(response)) 133 134 def get_counters(self, test_run_id, group_names, include_summary=None): 135 """GetCounters. 136 :param str test_run_id: The test run identifier 137 :param str group_names: Comma separated names of counter groups, such as 'Application', 'Performance' and 'Throughput' 138 :param bool include_summary: 139 :rtype: [TestRunCounterInstance] 140 """ 141 route_values = {} 142 if test_run_id is not None: 143 route_values['testRunId'] = self._serialize.url('test_run_id', test_run_id, 'str') 144 query_parameters = {} 145 if group_names is not None: 146 query_parameters['groupNames'] = self._serialize.query('group_names', group_names, 'str') 147 if include_summary is not None: 148 query_parameters['includeSummary'] = self._serialize.query('include_summary', include_summary, 'bool') 149 response = self._send(http_method='GET', 150 location_id='29265ea4-b5a5-4b2e-b054-47f5f6f00183', 151 version='4.1', 152 route_values=route_values, 153 query_parameters=query_parameters) 154 return self._deserialize('[TestRunCounterInstance]', self._unwrap_collection(response)) 155 156 def get_application_counters(self, application_id=None, plugintype=None): 157 """GetApplicationCounters. 158 :param str application_id: Filter by APM application identifier. 159 :param str plugintype: Currently ApplicationInsights is the only available plugin type. 160 :rtype: [ApplicationCounters] 161 """ 162 query_parameters = {} 163 if application_id is not None: 164 query_parameters['applicationId'] = self._serialize.query('application_id', application_id, 'str') 165 if plugintype is not None: 166 query_parameters['plugintype'] = self._serialize.query('plugintype', plugintype, 'str') 167 response = self._send(http_method='GET', 168 location_id='c1275ce9-6d26-4bc6-926b-b846502e812d', 169 version='4.1', 170 query_parameters=query_parameters) 171 return self._deserialize('[ApplicationCounters]', self._unwrap_collection(response)) 172 173 def get_counter_samples(self, counter_sample_query_details, test_run_id): 174 """GetCounterSamples. 175 :param :class:`<VssJsonCollectionWrapper> <cloud-load-test.v4_1.models.VssJsonCollectionWrapper>` counter_sample_query_details: 176 :param str test_run_id: The test run identifier 177 :rtype: :class:`<CounterSamplesResult> <cloud-load-test.v4_1.models.CounterSamplesResult>` 178 """ 179 route_values = {} 180 if test_run_id is not None: 181 route_values['testRunId'] = self._serialize.url('test_run_id', test_run_id, 'str') 182 content = self._serialize.body(counter_sample_query_details, 'VssJsonCollectionWrapper') 183 response = self._send(http_method='POST', 184 location_id='bad18480-7193-4518-992a-37289c5bb92d', 185 version='4.1', 186 route_values=route_values, 187 content=content) 188 return self._deserialize('CounterSamplesResult', response) 189 190 def get_load_test_run_errors(self, test_run_id, type=None, sub_type=None, detailed=None): 191 """GetLoadTestRunErrors. 192 :param str test_run_id: The test run identifier 193 :param str type: Filter for the particular type of errors. 194 :param str sub_type: Filter for a particular subtype of errors. You should not provide error subtype without error type. 195 :param bool detailed: To include the details of test errors such as messagetext, request, stacktrace, testcasename, scenarioname, and lasterrordate. 196 :rtype: :class:`<LoadTestErrors> <cloud-load-test.v4_1.models.LoadTestErrors>` 197 """ 198 route_values = {} 199 if test_run_id is not None: 200 route_values['testRunId'] = self._serialize.url('test_run_id', test_run_id, 'str') 201 query_parameters = {} 202 if type is not None: 203 query_parameters['type'] = self._serialize.query('type', type, 'str') 204 if sub_type is not None: 205 query_parameters['subType'] = self._serialize.query('sub_type', sub_type, 'str') 206 if detailed is not None: 207 query_parameters['detailed'] = self._serialize.query('detailed', detailed, 'bool') 208 response = self._send(http_method='GET', 209 location_id='b52025a7-3fb4-4283-8825-7079e75bd402', 210 version='4.1', 211 route_values=route_values, 212 query_parameters=query_parameters) 213 return self._deserialize('LoadTestErrors', response) 214 215 def get_test_run_messages(self, test_run_id): 216 """GetTestRunMessages. 217 :param str test_run_id: Id of the test run 218 :rtype: [Microsoft.VisualStudio.TestService.WebApiModel.TestRunMessage] 219 """ 220 route_values = {} 221 if test_run_id is not None: 222 route_values['testRunId'] = self._serialize.url('test_run_id', test_run_id, 'str') 223 response = self._send(http_method='GET', 224 location_id='2e7ba122-f522-4205-845b-2d270e59850a', 225 version='4.1', 226 route_values=route_values) 227 return self._deserialize('[Microsoft.VisualStudio.TestService.WebApiModel.TestRunMessage]', self._unwrap_collection(response)) 228 229 def get_plugin(self, type): 230 """GetPlugin. 231 :param str type: Currently ApplicationInsights is the only available plugin type. 232 :rtype: :class:`<ApplicationType> <cloud-load-test.v4_1.models.ApplicationType>` 233 """ 234 route_values = {} 235 if type is not None: 236 route_values['type'] = self._serialize.url('type', type, 'str') 237 response = self._send(http_method='GET', 238 location_id='7dcb0bb2-42d5-4729-9958-c0401d5e7693', 239 version='4.1', 240 route_values=route_values) 241 return self._deserialize('ApplicationType', response) 242 243 def get_plugins(self): 244 """GetPlugins. 245 :rtype: [ApplicationType] 246 """ 247 response = self._send(http_method='GET', 248 location_id='7dcb0bb2-42d5-4729-9958-c0401d5e7693', 249 version='4.1') 250 return self._deserialize('[ApplicationType]', self._unwrap_collection(response)) 251 252 def get_load_test_result(self, test_run_id): 253 """GetLoadTestResult. 254 :param str test_run_id: The test run identifier 255 :rtype: :class:`<TestResults> <cloud-load-test.v4_1.models.TestResults>` 256 """ 257 route_values = {} 258 if test_run_id is not None: 259 route_values['testRunId'] = self._serialize.url('test_run_id', test_run_id, 'str') 260 response = self._send(http_method='GET', 261 location_id='5ed69bd8-4557-4cec-9b75-1ad67d0c257b', 262 version='4.1', 263 route_values=route_values) 264 return self._deserialize('TestResults', response) 265 266 def create_test_definition(self, test_definition): 267 """CreateTestDefinition. 268 :param :class:`<TestDefinition> <cloud-load-test.v4_1.models.TestDefinition>` test_definition: Test definition to be created 269 :rtype: :class:`<TestDefinition> <cloud-load-test.v4_1.models.TestDefinition>` 270 """ 271 content = self._serialize.body(test_definition, 'TestDefinition') 272 response = self._send(http_method='POST', 273 location_id='a8f9b135-f604-41ea-9d74-d9a5fd32fcd8', 274 version='4.1', 275 content=content) 276 return self._deserialize('TestDefinition', response) 277 278 def get_test_definition(self, test_definition_id): 279 """GetTestDefinition. 280 :param str test_definition_id: The test definition identifier 281 :rtype: :class:`<TestDefinition> <cloud-load-test.v4_1.models.TestDefinition>` 282 """ 283 route_values = {} 284 if test_definition_id is not None: 285 route_values['testDefinitionId'] = self._serialize.url('test_definition_id', test_definition_id, 'str') 286 response = self._send(http_method='GET', 287 location_id='a8f9b135-f604-41ea-9d74-d9a5fd32fcd8', 288 version='4.1', 289 route_values=route_values) 290 return self._deserialize('TestDefinition', response) 291 292 def get_test_definitions(self, from_date=None, to_date=None, top=None): 293 """GetTestDefinitions. 294 :param str from_date: Date after which test definitions were created 295 :param str to_date: Date before which test definitions were crated 296 :param int top: 297 :rtype: [TestDefinitionBasic] 298 """ 299 query_parameters = {} 300 if from_date is not None: 301 query_parameters['fromDate'] = self._serialize.query('from_date', from_date, 'str') 302 if to_date is not None: 303 query_parameters['toDate'] = self._serialize.query('to_date', to_date, 'str') 304 if top is not None: 305 query_parameters['top'] = self._serialize.query('top', top, 'int') 306 response = self._send(http_method='GET', 307 location_id='a8f9b135-f604-41ea-9d74-d9a5fd32fcd8', 308 version='4.1', 309 query_parameters=query_parameters) 310 return self._deserialize('[TestDefinitionBasic]', self._unwrap_collection(response)) 311 312 def update_test_definition(self, test_definition): 313 """UpdateTestDefinition. 314 :param :class:`<TestDefinition> <cloud-load-test.v4_1.models.TestDefinition>` test_definition: 315 :rtype: :class:`<TestDefinition> <cloud-load-test.v4_1.models.TestDefinition>` 316 """ 317 content = self._serialize.body(test_definition, 'TestDefinition') 318 response = self._send(http_method='PUT', 319 location_id='a8f9b135-f604-41ea-9d74-d9a5fd32fcd8', 320 version='4.1', 321 content=content) 322 return self._deserialize('TestDefinition', response) 323 324 def create_test_drop(self, web_test_drop): 325 """CreateTestDrop. 326 :param :class:`<Microsoft.VisualStudio.TestService.WebApiModel.TestDrop> <cloud-load-test.v4_1.models.Microsoft.VisualStudio.TestService.WebApiModel.TestDrop>` web_test_drop: Test drop to be created 327 :rtype: :class:`<Microsoft.VisualStudio.TestService.WebApiModel.TestDrop> <cloud-load-test.v4_1.models.Microsoft.VisualStudio.TestService.WebApiModel.TestDrop>` 328 """ 329 content = self._serialize.body(web_test_drop, 'Microsoft.VisualStudio.TestService.WebApiModel.TestDrop') 330 response = self._send(http_method='POST', 331 location_id='d89d0e08-505c-4357-96f6-9729311ce8ad', 332 version='4.1', 333 content=content) 334 return self._deserialize('Microsoft.VisualStudio.TestService.WebApiModel.TestDrop', response) 335 336 def get_test_drop(self, test_drop_id): 337 """GetTestDrop. 338 :param str test_drop_id: The test drop identifier 339 :rtype: :class:`<Microsoft.VisualStudio.TestService.WebApiModel.TestDrop> <cloud-load-test.v4_1.models.Microsoft.VisualStudio.TestService.WebApiModel.TestDrop>` 340 """ 341 route_values = {} 342 if test_drop_id is not None: 343 route_values['testDropId'] = self._serialize.url('test_drop_id', test_drop_id, 'str') 344 response = self._send(http_method='GET', 345 location_id='d89d0e08-505c-4357-96f6-9729311ce8ad', 346 version='4.1', 347 route_values=route_values) 348 return self._deserialize('Microsoft.VisualStudio.TestService.WebApiModel.TestDrop', response) 349 350 def create_test_run(self, web_test_run): 351 """CreateTestRun. 352 :param :class:`<TestRun> <cloud-load-test.v4_1.models.TestRun>` web_test_run: 353 :rtype: :class:`<TestRun> <cloud-load-test.v4_1.models.TestRun>` 354 """ 355 content = self._serialize.body(web_test_run, 'TestRun') 356 response = self._send(http_method='POST', 357 location_id='b41a84ff-ff03-4ac1-b76e-e7ea25c92aba', 358 version='4.1', 359 content=content) 360 return self._deserialize('TestRun', response) 361 362 def get_test_run(self, test_run_id): 363 """GetTestRun. 364 :param str test_run_id: Unique ID of the test run 365 :rtype: :class:`<TestRun> <cloud-load-test.v4_1.models.TestRun>` 366 """ 367 route_values = {} 368 if test_run_id is not None: 369 route_values['testRunId'] = self._serialize.url('test_run_id', test_run_id, 'str') 370 response = self._send(http_method='GET', 371 location_id='b41a84ff-ff03-4ac1-b76e-e7ea25c92aba', 372 version='4.1', 373 route_values=route_values) 374 return self._deserialize('TestRun', response) 375 376 def get_test_runs(self, name=None, requested_by=None, status=None, run_type=None, from_date=None, to_date=None, detailed=None, top=None, runsourceidentifier=None, retention_state=None): 377 """GetTestRuns. 378 Returns test runs based on the filter specified. Returns all runs of the tenant if there is no filter. 379 :param str name: Name for the test run. Names are not unique. Test runs with same name are assigned sequential rolling numbers. 380 :param str requested_by: Filter by the user who requested the test run. Here requestedBy should be the display name of the user. 381 :param str status: Filter by the test run status. 382 :param str run_type: Valid values include: null, one of TestRunType, or "*" 383 :param str from_date: Filter by the test runs that have been modified after the fromDate timestamp. 384 :param str to_date: Filter by the test runs that have been modified before the toDate timestamp. 385 :param bool detailed: Include the detailed test run attributes. 386 :param int top: The maximum number of test runs to return. 387 :param str runsourceidentifier: 388 :param str retention_state: 389 :rtype: object 390 """ 391 query_parameters = {} 392 if name is not None: 393 query_parameters['name'] = self._serialize.query('name', name, 'str') 394 if requested_by is not None: 395 query_parameters['requestedBy'] = self._serialize.query('requested_by', requested_by, 'str') 396 if status is not None: 397 query_parameters['status'] = self._serialize.query('status', status, 'str') 398 if run_type is not None: 399 query_parameters['runType'] = self._serialize.query('run_type', run_type, 'str') 400 if from_date is not None: 401 query_parameters['fromDate'] = self._serialize.query('from_date', from_date, 'str') 402 if to_date is not None: 403 query_parameters['toDate'] = self._serialize.query('to_date', to_date, 'str') 404 if detailed is not None: 405 query_parameters['detailed'] = self._serialize.query('detailed', detailed, 'bool') 406 if top is not None: 407 query_parameters['top'] = self._serialize.query('top', top, 'int') 408 if runsourceidentifier is not None: 409 query_parameters['runsourceidentifier'] = self._serialize.query('runsourceidentifier', runsourceidentifier, 'str') 410 if retention_state is not None: 411 query_parameters['retentionState'] = self._serialize.query('retention_state', retention_state, 'str') 412 response = self._send(http_method='GET', 413 location_id='b41a84ff-ff03-4ac1-b76e-e7ea25c92aba', 414 version='4.1', 415 query_parameters=query_parameters) 416 return self._deserialize('object', response) 417 418 def update_test_run(self, web_test_run, test_run_id): 419 """UpdateTestRun. 420 :param :class:`<TestRun> <cloud-load-test.v4_1.models.TestRun>` web_test_run: 421 :param str test_run_id: 422 """ 423 route_values = {} 424 if test_run_id is not None: 425 route_values['testRunId'] = self._serialize.url('test_run_id', test_run_id, 'str') 426 content = self._serialize.body(web_test_run, 'TestRun') 427 self._send(http_method='PATCH', 428 location_id='b41a84ff-ff03-4ac1-b76e-e7ea25c92aba', 429 version='4.1', 430 route_values=route_values, 431 content=content) 432 433