diff --git a/sdk/loadtesting/azure-developer-loadtesting/MANIFEST.in b/sdk/loadtesting/azure-developer-loadtesting/MANIFEST.in index 6ebb7e55a108..32f595395d47 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/MANIFEST.in +++ b/sdk/loadtesting/azure-developer-loadtesting/MANIFEST.in @@ -4,4 +4,4 @@ include azure/developer/loadtesting/py.typed recursive-include tests *.py recursive-include samples *.py *.md include azure/__init__.py -include azure/developer/__init__.py \ No newline at end of file +include azure/developer/__init__.py diff --git a/sdk/loadtesting/azure-developer-loadtesting/_meta.json b/sdk/loadtesting/azure-developer-loadtesting/_meta.json new file mode 100644 index 000000000000..2f2eb29b2cc9 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/_meta.json @@ -0,0 +1,6 @@ +{ + "commit": "2ad82511706dc035660b16b4754eb4232a9fc4dc", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "typespec_src": "specification/loadtestservice/LoadTestService", + "@azure-tools/typespec-python": "0.44.1" +} \ No newline at end of file diff --git a/sdk/loadtesting/azure-developer-loadtesting/apiview-properties.json b/sdk/loadtesting/azure-developer-loadtesting/apiview-properties.json new file mode 100644 index 000000000000..0b896e9d333f --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/apiview-properties.json @@ -0,0 +1,182 @@ +{ + "CrossLanguagePackageId": "Microsoft.LoadTestService", + "CrossLanguageDefinitionId": { + "azure.developer.loadtesting.models.AppComponent": "Microsoft.LoadTestService.AppComponent", + "azure.developer.loadtesting.models.ArtifactsContainerInfo": "Microsoft.LoadTestService.ArtifactsContainerInfo", + "azure.developer.loadtesting.models.AutoStopCriteria": "Microsoft.LoadTestService.AutoStopCriteria", + "azure.developer.loadtesting.models.CertificateMetadata": "Microsoft.LoadTestService.CertificateMetadata", + "azure.developer.loadtesting.models.Recurrence": "Microsoft.LoadTestService.Recurrence", + "azure.developer.loadtesting.models.DailyRecurrence": "Microsoft.LoadTestService.DailyRecurrence", + "azure.developer.loadtesting.models.DimensionFilter": "Microsoft.LoadTestService.DimensionFilter", + "azure.developer.loadtesting.models.DimensionValue": "Microsoft.LoadTestService.DimensionValue", + "azure.developer.loadtesting.models.ErrorDetails": "Microsoft.LoadTestService.ErrorDetails", + "azure.developer.loadtesting.models.FunctionFlexConsumptionResourceConfiguration": "Microsoft.LoadTestService.FunctionFlexConsumptionResourceConfiguration", + "azure.developer.loadtesting.models.TargetResourceConfigurations": "Microsoft.LoadTestService.TargetResourceConfigurations", + "azure.developer.loadtesting.models.FunctionFlexConsumptionTargetResourceConfigurations": "Microsoft.LoadTestService.FunctionFlexConsumptionTargetResourceConfigurations", + "azure.developer.loadtesting.models.HourlyRecurrence": "Microsoft.LoadTestService.HourlyRecurrence", + "azure.developer.loadtesting.models.LoadTestConfiguration": "Microsoft.LoadTestService.LoadTestConfiguration", + "azure.developer.loadtesting.models.MetricAvailability": "Microsoft.LoadTestService.MetricAvailability", + "azure.developer.loadtesting.models.MetricDefinition": "Microsoft.LoadTestService.MetricDefinition", + "azure.developer.loadtesting.models.MetricDefinitionCollection": "Microsoft.LoadTestService.MetricDefinitionCollection", + "azure.developer.loadtesting.models.MetricNamespace": "Microsoft.LoadTestService.MetricNamespace", + "azure.developer.loadtesting.models.MetricNamespaceCollection": "Microsoft.LoadTestService.MetricNamespaceCollection", + "azure.developer.loadtesting.models.MetricRequestPayload": "Microsoft.LoadTestService.MetricRequestPayload", + "azure.developer.loadtesting.models.MetricValue": "Microsoft.LoadTestService.MetricValue", + "azure.developer.loadtesting.models.MonthlyRecurrenceByDates": "Microsoft.LoadTestService.MonthlyRecurrenceByDates", + "azure.developer.loadtesting.models.MonthlyRecurrenceByWeekDays": "Microsoft.LoadTestService.MonthlyRecurrenceByWeekDays", + "azure.developer.loadtesting.models.NameAndDescription": "Microsoft.LoadTestService.NameAndDescription", + "azure.developer.loadtesting.models.NotificationRule": "Microsoft.LoadTestService.NotificationRule", + "azure.developer.loadtesting.models.OperationStatus": "Microsoft.LoadTestService.OperationStatus", + "azure.developer.loadtesting.models.OptionalLoadTestConfiguration": "Microsoft.LoadTestService.OptionalLoadTestConfiguration", + "azure.developer.loadtesting.models.PassFailCriteria": "Microsoft.LoadTestService.PassFailCriteria", + "azure.developer.loadtesting.models.PassFailMetric": "Microsoft.LoadTestService.PassFailMetric", + "azure.developer.loadtesting.models.PassFailServerMetric": "Microsoft.LoadTestService.PassFailServerMetric", + "azure.developer.loadtesting.models.RecurrenceEnd": "Microsoft.LoadTestService.RecurrenceEnd", + "azure.developer.loadtesting.models.RecurrenceStatus": "Microsoft.LoadTestService.RecurrenceStatus", + "azure.developer.loadtesting.models.RecurrenceWithCron": "Microsoft.LoadTestService.RecurrenceWithCron", + "azure.developer.loadtesting.models.RegionalConfiguration": "Microsoft.LoadTestService.RegionalConfiguration", + "azure.developer.loadtesting.models.ResourceMetric": "Microsoft.LoadTestService.ResourceMetric", + "azure.developer.loadtesting.models.Trigger": "Microsoft.LoadTestService.Trigger", + "azure.developer.loadtesting.models.ScheduleTestsTrigger": "Microsoft.LoadTestService.ScheduleTestsTrigger", + "azure.developer.loadtesting.models.Secret": "Microsoft.LoadTestService.Secret", + "azure.developer.loadtesting.models.StateDetails": "Microsoft.LoadTestService.StateDetails", + "azure.developer.loadtesting.models.Test": "Microsoft.LoadTestService.Test", + "azure.developer.loadtesting.models.TestAppComponents": "Microsoft.LoadTestService.TestAppComponents", + "azure.developer.loadtesting.models.TestFileInfo": "Microsoft.LoadTestService.TestFileInfo", + "azure.developer.loadtesting.models.TestInputArtifacts": "Microsoft.LoadTestService.TestInputArtifacts", + "azure.developer.loadtesting.models.TestProfile": "Microsoft.LoadTestService.TestProfile", + "azure.developer.loadtesting.models.TestProfileRun": "Microsoft.LoadTestService.TestProfileRun", + "azure.developer.loadtesting.models.TestProfileRunRecommendation": "Microsoft.LoadTestService.TestProfileRunRecommendation", + "azure.developer.loadtesting.models.TestRun": "Microsoft.LoadTestService.TestRun", + "azure.developer.loadtesting.models.TestRunAppComponents": "Microsoft.LoadTestService.TestRunAppComponents", + "azure.developer.loadtesting.models.TestRunArtifacts": "Microsoft.LoadTestService.TestRunArtifacts", + "azure.developer.loadtesting.models.TestRunDetail": "Microsoft.LoadTestService.TestRunDetail", + "azure.developer.loadtesting.models.TestRunEndedEventCondition": "Microsoft.LoadTestService.TestRunEndedEventCondition", + "azure.developer.loadtesting.models.TestsNotificationEventFilter": "Microsoft.LoadTestService.TestsNotificationEventFilter", + "azure.developer.loadtesting.models.TestRunEndedNotificationEventFilter": "Microsoft.LoadTestService.TestRunEndedNotificationEventFilter", + "azure.developer.loadtesting.models.TestRunFileInfo": "Microsoft.LoadTestService.TestRunFileInfo", + "azure.developer.loadtesting.models.TestRunInputArtifacts": "Microsoft.LoadTestService.TestRunInputArtifacts", + "azure.developer.loadtesting.models.TestRunOutputArtifacts": "Microsoft.LoadTestService.TestRunOutputArtifacts", + "azure.developer.loadtesting.models.TestRunServerMetricsConfiguration": "Microsoft.LoadTestService.TestRunServerMetricsConfiguration", + "azure.developer.loadtesting.models.TestRunStartedNotificationEventFilter": "Microsoft.LoadTestService.TestRunStartedNotificationEventFilter", + "azure.developer.loadtesting.models.TestRunStatistics": "Microsoft.LoadTestService.TestRunStatistics", + "azure.developer.loadtesting.models.TestServerMetricsConfiguration": "Microsoft.LoadTestService.TestServerMetricsConfiguration", + "azure.developer.loadtesting.models.TestsNotificationRule": "Microsoft.LoadTestService.TestsNotificationRule", + "azure.developer.loadtesting.models.TimeSeriesElement": "Microsoft.LoadTestService.TimeSeriesElement", + "azure.developer.loadtesting.models.TriggerCompletedNotificationEventFilter": "Microsoft.LoadTestService.TriggerCompletedNotificationEventFilter", + "azure.developer.loadtesting.models.TriggerDisabledNotificationEventFilter": "Microsoft.LoadTestService.TriggerDisabledNotificationEventFilter", + "azure.developer.loadtesting.models.WeeklyRecurrence": "Microsoft.LoadTestService.WeeklyRecurrence", + "azure.developer.loadtesting.models.PFMetrics": "Microsoft.LoadTestService.PFMetrics", + "azure.developer.loadtesting.models.PassFailAggregationFunction": "Microsoft.LoadTestService.PassFailAggregationFunction", + "azure.developer.loadtesting.models.PassFailAction": "Microsoft.LoadTestService.PassFailAction", + "azure.developer.loadtesting.models.PassFailResult": "Microsoft.LoadTestService.PassFailResult", + "azure.developer.loadtesting.models.SecretType": "Microsoft.LoadTestService.SecretType", + "azure.developer.loadtesting.models.CertificateType": "Microsoft.LoadTestService.CertificateType", + "azure.developer.loadtesting.models.FileType": "Microsoft.LoadTestService.FileType", + "azure.developer.loadtesting.models.FileValidationStatus": "Microsoft.LoadTestService.FileValidationStatus", + "azure.developer.loadtesting.models.TestKind": "Microsoft.LoadTestService.TestKind", + "azure.developer.loadtesting.models.ManagedIdentityType": "Microsoft.LoadTestService.ManagedIdentityType", + "azure.developer.loadtesting.models.ResourceKind": "Microsoft.LoadTestService.ResourceKind", + "azure.developer.loadtesting.models.TriggerType": "Microsoft.LoadTestService.TriggerType", + "azure.developer.loadtesting.models.TriggerState": "Microsoft.LoadTestService.TriggerState", + "azure.developer.loadtesting.models.Frequency": "Microsoft.LoadTestService.Frequency", + "azure.developer.loadtesting.models.WeekDays": "Microsoft.LoadTestService.WeekDays", + "azure.developer.loadtesting.models.NotificationScopeType": "Microsoft.LoadTestService.NotificationScopeType", + "azure.developer.loadtesting.models.NotificationEventType": "Microsoft.LoadTestService.NotificationEventType", + "azure.developer.loadtesting.models.TestRunStatus": "Microsoft.LoadTestService.TestRunStatus", + "azure.developer.loadtesting.models.PassFailTestResult": "Microsoft.LoadTestService.PassFailTestResult", + "azure.developer.loadtesting.models.OperationState": "Azure.Core.Foundations.OperationState", + "azure.developer.loadtesting.models.OperationKind": "Microsoft.LoadTestService.OperationKind", + "azure.developer.loadtesting.models.RequestDataLevel": "Microsoft.LoadTestService.RequestDataLevel", + "azure.developer.loadtesting.models.CreatedByType": "Microsoft.LoadTestService.CreatedByType", + "azure.developer.loadtesting.models.TimeGrain": "Microsoft.LoadTestService.TimeGrain", + "azure.developer.loadtesting.models.Aggregation": "Microsoft.LoadTestService.Aggregation", + "azure.developer.loadtesting.models.MetricUnit": "Microsoft.LoadTestService.MetricUnit", + "azure.developer.loadtesting.models.TestProfileRunStatus": "Microsoft.LoadTestService.TestProfileRunStatus", + "azure.developer.loadtesting.models.RecommendationCategory": "Microsoft.LoadTestService.RecommendationCategory", + "azure.developer.loadtesting.LoadTestAdministrationClient.create_or_update_test": "Customizations.AdministrationOperations.createOrUpdateTest", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.create_or_update_test": "Customizations.AdministrationOperations.createOrUpdateTest", + "azure.developer.loadtesting.LoadTestAdministrationClient.create_or_update_app_components": "Customizations.AdministrationOperations.createOrUpdateAppComponents", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.create_or_update_app_components": "Customizations.AdministrationOperations.createOrUpdateAppComponents", + "azure.developer.loadtesting.LoadTestAdministrationClient.create_or_update_server_metrics_config": "Customizations.AdministrationOperations.createOrUpdateServerMetricsConfig", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.create_or_update_server_metrics_config": "Customizations.AdministrationOperations.createOrUpdateServerMetricsConfig", + "azure.developer.loadtesting.LoadTestAdministrationClient.get_app_components": "Customizations.AdministrationOperations.getAppComponents", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.get_app_components": "Customizations.AdministrationOperations.getAppComponents", + "azure.developer.loadtesting.LoadTestAdministrationClient.get_server_metrics_config": "Customizations.AdministrationOperations.getServerMetricsConfig", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.get_server_metrics_config": "Customizations.AdministrationOperations.getServerMetricsConfig", + "azure.developer.loadtesting.LoadTestAdministrationClient.get_test": "Customizations.AdministrationOperations.getTest", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.get_test": "Customizations.AdministrationOperations.getTest", + "azure.developer.loadtesting.LoadTestAdministrationClient.get_test_file": "Customizations.AdministrationOperations.getTestFile", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.get_test_file": "Customizations.AdministrationOperations.getTestFile", + "azure.developer.loadtesting.LoadTestAdministrationClient.list_test_files": "Customizations.AdministrationOperations.listTestFiles", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.list_test_files": "Customizations.AdministrationOperations.listTestFiles", + "azure.developer.loadtesting.LoadTestAdministrationClient.list_tests": "Customizations.AdministrationOperations.listTests", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.list_tests": "Customizations.AdministrationOperations.listTests", + "azure.developer.loadtesting.LoadTestAdministrationClient.delete_test_file": "Customizations.AdministrationOperations.deleteTestFile", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.delete_test_file": "Customizations.AdministrationOperations.deleteTestFile", + "azure.developer.loadtesting.LoadTestAdministrationClient.delete_test": "Customizations.AdministrationOperations.deleteTest", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.delete_test": "Customizations.AdministrationOperations.deleteTest", + "azure.developer.loadtesting.LoadTestAdministrationClient.create_or_update_test_profile": "Customizations.AdministrationOperations.createOrUpdateTestProfile", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.create_or_update_test_profile": "Customizations.AdministrationOperations.createOrUpdateTestProfile", + "azure.developer.loadtesting.LoadTestAdministrationClient.delete_test_profile": "Customizations.AdministrationOperations.deleteTestProfile", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.delete_test_profile": "Customizations.AdministrationOperations.deleteTestProfile", + "azure.developer.loadtesting.LoadTestAdministrationClient.get_test_profile": "Customizations.AdministrationOperations.getTestProfile", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.get_test_profile": "Customizations.AdministrationOperations.getTestProfile", + "azure.developer.loadtesting.LoadTestAdministrationClient.list_test_profiles": "Customizations.AdministrationOperations.listTestProfiles", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.list_test_profiles": "Customizations.AdministrationOperations.listTestProfiles", + "azure.developer.loadtesting.LoadTestAdministrationClient.create_or_update_trigger": "Customizations.AdministrationOperations.createOrUpdateTrigger", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.create_or_update_trigger": "Customizations.AdministrationOperations.createOrUpdateTrigger", + "azure.developer.loadtesting.LoadTestAdministrationClient.delete_trigger": "Customizations.AdministrationOperations.deleteTrigger", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.delete_trigger": "Customizations.AdministrationOperations.deleteTrigger", + "azure.developer.loadtesting.LoadTestAdministrationClient.get_trigger": "Customizations.AdministrationOperations.getTrigger", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.get_trigger": "Customizations.AdministrationOperations.getTrigger", + "azure.developer.loadtesting.LoadTestAdministrationClient.list_triggers": "Customizations.AdministrationOperations.listTriggers", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.list_triggers": "Customizations.AdministrationOperations.listTriggers", + "azure.developer.loadtesting.LoadTestAdministrationClient.create_or_update_notification_rule": "Customizations.AdministrationOperations.createOrUpdateNotificationRule", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.create_or_update_notification_rule": "Customizations.AdministrationOperations.createOrUpdateNotificationRule", + "azure.developer.loadtesting.LoadTestAdministrationClient.delete_notification_rule": "Customizations.AdministrationOperations.deleteNotificationRule", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.delete_notification_rule": "Customizations.AdministrationOperations.deleteNotificationRule", + "azure.developer.loadtesting.LoadTestAdministrationClient.get_notification_rule": "Customizations.AdministrationOperations.getNotificationRule", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.get_notification_rule": "Customizations.AdministrationOperations.getNotificationRule", + "azure.developer.loadtesting.LoadTestAdministrationClient.list_notification_rules": "Customizations.AdministrationOperations.listNotificationRules", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.list_notification_rules": "Customizations.AdministrationOperations.listNotificationRules", + "azure.developer.loadtesting.LoadTestAdministrationClient.begin_clone_test": "Customizations.AdministrationOperations.cloneTest", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.begin_clone_test": "Customizations.AdministrationOperations.cloneTest", + "azure.developer.loadtesting.LoadTestAdministrationClient.get_operation_status": "Customizations.AdministrationOperations.getOperationStatus", + "azure.developer.loadtesting.aio.LoadTestAdministrationClient.get_operation_status": "Customizations.AdministrationOperations.getOperationStatus", + "azure.developer.loadtesting.LoadTestRunClient.create_or_update_app_components": "Customizations.TestRunOperations.createOrUpdateAppComponents", + "azure.developer.loadtesting.aio.LoadTestRunClient.create_or_update_app_components": "Customizations.TestRunOperations.createOrUpdateAppComponents", + "azure.developer.loadtesting.LoadTestRunClient.create_or_update_server_metrics_config": "Customizations.TestRunOperations.createOrUpdateServerMetricsConfig", + "azure.developer.loadtesting.aio.LoadTestRunClient.create_or_update_server_metrics_config": "Customizations.TestRunOperations.createOrUpdateServerMetricsConfig", + "azure.developer.loadtesting.LoadTestRunClient.delete_test_run": "Customizations.TestRunOperations.deleteTestRun", + "azure.developer.loadtesting.aio.LoadTestRunClient.delete_test_run": "Customizations.TestRunOperations.deleteTestRun", + "azure.developer.loadtesting.LoadTestRunClient.get_app_components": "Customizations.TestRunOperations.getAppComponents", + "azure.developer.loadtesting.aio.LoadTestRunClient.get_app_components": "Customizations.TestRunOperations.getAppComponents", + "azure.developer.loadtesting.LoadTestRunClient.get_server_metrics_config": "Customizations.TestRunOperations.getServerMetricsConfig", + "azure.developer.loadtesting.aio.LoadTestRunClient.get_server_metrics_config": "Customizations.TestRunOperations.getServerMetricsConfig", + "azure.developer.loadtesting.LoadTestRunClient.get_test_run": "Customizations.TestRunOperations.getTestRun", + "azure.developer.loadtesting.aio.LoadTestRunClient.get_test_run": "Customizations.TestRunOperations.getTestRun", + "azure.developer.loadtesting.LoadTestRunClient.get_test_run_file": "Customizations.TestRunOperations.getTestRunFile", + "azure.developer.loadtesting.aio.LoadTestRunClient.get_test_run_file": "Customizations.TestRunOperations.getTestRunFile", + "azure.developer.loadtesting.LoadTestRunClient.list_metric_dimension_values": "Customizations.TestRunOperations.listMetricDimensionValues", + "azure.developer.loadtesting.aio.LoadTestRunClient.list_metric_dimension_values": "Customizations.TestRunOperations.listMetricDimensionValues", + "azure.developer.loadtesting.LoadTestRunClient.get_metric_definitions": "Customizations.TestRunOperations.listMetricDefinitions", + "azure.developer.loadtesting.aio.LoadTestRunClient.get_metric_definitions": "Customizations.TestRunOperations.listMetricDefinitions", + "azure.developer.loadtesting.LoadTestRunClient.get_metric_namespaces": "Customizations.TestRunOperations.listMetricNamespaces", + "azure.developer.loadtesting.aio.LoadTestRunClient.get_metric_namespaces": "Customizations.TestRunOperations.listMetricNamespaces", + "azure.developer.loadtesting.LoadTestRunClient.list_metrics": "Customizations.TestRunOperations.listMetrics", + "azure.developer.loadtesting.aio.LoadTestRunClient.list_metrics": "Customizations.TestRunOperations.listMetrics", + "azure.developer.loadtesting.LoadTestRunClient.list_test_runs": "Customizations.TestRunOperations.listTestRuns", + "azure.developer.loadtesting.aio.LoadTestRunClient.list_test_runs": "Customizations.TestRunOperations.listTestRuns", + "azure.developer.loadtesting.LoadTestRunClient.stop_test_run": "Customizations.TestRunOperations.stop", + "azure.developer.loadtesting.aio.LoadTestRunClient.stop_test_run": "Customizations.TestRunOperations.stop", + "azure.developer.loadtesting.LoadTestRunClient.delete_test_profile_run": "Customizations.TestRunOperations.deleteTestProfileRun", + "azure.developer.loadtesting.aio.LoadTestRunClient.delete_test_profile_run": "Customizations.TestRunOperations.deleteTestProfileRun", + "azure.developer.loadtesting.LoadTestRunClient.get_test_profile_run": "Customizations.TestRunOperations.getTestProfileRun", + "azure.developer.loadtesting.aio.LoadTestRunClient.get_test_profile_run": "Customizations.TestRunOperations.getTestProfileRun", + "azure.developer.loadtesting.LoadTestRunClient.list_test_profile_runs": "Customizations.TestRunOperations.listTestProfileRuns", + "azure.developer.loadtesting.aio.LoadTestRunClient.list_test_profile_runs": "Customizations.TestRunOperations.listTestProfileRuns", + "azure.developer.loadtesting.LoadTestRunClient.stop_test_profile_run": "Customizations.TestRunOperations.stopTestProfileRun", + "azure.developer.loadtesting.aio.LoadTestRunClient.stop_test_profile_run": "Customizations.TestRunOperations.stopTestProfileRun" + } +} \ No newline at end of file diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_client.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_client.py index 3e5aa0fba177..e630b8ca61ce 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_client.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_client.py @@ -16,7 +16,7 @@ from ._configuration import LoadTestAdministrationClientConfiguration, LoadTestRunClientConfiguration from ._operations import LoadTestAdministrationClientOperationsMixin, LoadTestRunClientOperationsMixin -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer if TYPE_CHECKING: from azure.core.credentials import TokenCredential @@ -30,14 +30,17 @@ class LoadTestAdministrationClient(LoadTestAdministrationClientOperationsMixin): :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-12-01-preview". Note that overriding this default value may result in unsupported + "2025-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: _endpoint = "https://{endpoint}" self._config = LoadTestAdministrationClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -106,7 +109,7 @@ class LoadTestRunClient(LoadTestRunClientOperationsMixin): :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-12-01-preview". Note that overriding this default value may result in unsupported + "2025-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -114,6 +117,7 @@ class LoadTestRunClient(LoadTestRunClientOperationsMixin): def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: _endpoint = "https://{endpoint}" self._config = LoadTestRunClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_configuration.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_configuration.py index adf093acd20f..80628eba19c1 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_configuration.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_configuration.py @@ -27,13 +27,13 @@ class LoadTestAdministrationClientConfiguration: # pylint: disable=too-many-ins :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-12-01-preview". Note that overriding this default value may result in unsupported + "2025-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-12-01-preview") + api_version: str = kwargs.pop("api_version", "2025-03-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") @@ -75,13 +75,13 @@ class LoadTestRunClientConfiguration: # pylint: disable=too-many-instance-attri :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-12-01-preview". Note that overriding this default value may result in unsupported + "2025-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-12-01-preview") + api_version: str = kwargs.pop("api_version", "2025-03-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_operations/_operations.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_operations/_operations.py index 2e86f4dbdb46..a9d76133fcf9 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_operations/_operations.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_operations/_operations.py @@ -6,13 +6,14 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime from io import IOBase import json -import sys -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,21 +26,21 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.polling.base_polling import LROBasePolling from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from .. import models as _models -from .._model_base import SdkJSONEncoder, _deserialize -from .._serialization import Serializer +from .._configuration import LoadTestAdministrationClientConfiguration, LoadTestRunClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize +from .._utils.serialization import Serializer +from .._utils.utils import ClientMixinABC from .._validation import api_version_validation -from .._vendor import LoadTestAdministrationClientMixinABC, LoadTestRunClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] +_Unset: Any = object() T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +55,7 @@ def build_load_test_administration_create_or_update_test_request( # pylint: dis _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,7 +84,7 @@ def build_load_test_administration_create_or_update_app_components_request( # p _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +113,7 @@ def build_load_test_administration_create_or_update_server_metrics_config_reques _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,7 +141,7 @@ def build_load_test_administration_get_app_components_request( # pylint: disabl _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -166,7 +167,7 @@ def build_load_test_administration_get_server_metrics_config_request( # pylint: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -192,7 +193,7 @@ def build_load_test_administration_get_test_request( # pylint: disable=name-too _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,7 +219,7 @@ def build_load_test_administration_get_test_file_request( # pylint: disable=nam _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -245,7 +246,7 @@ def build_load_test_administration_list_test_files_request( # pylint: disable=n _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -277,7 +278,7 @@ def build_load_test_administration_list_tests_request( # pylint: disable=name-t _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -311,7 +312,7 @@ def build_load_test_administration_begin_upload_test_file_request( # pylint: di _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: str = kwargs.pop("content_type") - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -341,7 +342,7 @@ def build_load_test_administration_delete_test_file_request( # pylint: disable= _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -368,7 +369,7 @@ def build_load_test_administration_delete_test_request( # pylint: disable=name- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -395,7 +396,7 @@ def build_load_test_administration_create_or_update_test_profile_request( # pyl _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -423,7 +424,7 @@ def build_load_test_administration_delete_test_profile_request( # pylint: disab _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -449,7 +450,7 @@ def build_load_test_administration_get_test_profile_request( # pylint: disable= _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -481,7 +482,7 @@ def build_load_test_administration_list_test_profiles_request( # pylint: disabl _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -508,6 +509,301 @@ def build_load_test_administration_list_test_profiles_request( # pylint: disabl return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_load_test_administration_create_or_update_trigger_request( # pylint: disable=name-too-long + trigger_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/triggers/{triggerId}" + path_format_arguments = { + "triggerId": _SERIALIZER.url("trigger_id", trigger_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_load_test_administration_delete_trigger_request( # pylint: disable=name-too-long + trigger_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/triggers/{triggerId}" + path_format_arguments = { + "triggerId": _SERIALIZER.url("trigger_id", trigger_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_load_test_administration_get_trigger_request( # pylint: disable=name-too-long + trigger_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/triggers/{triggerId}" + path_format_arguments = { + "triggerId": _SERIALIZER.url("trigger_id", trigger_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_load_test_administration_list_triggers_request( # pylint: disable=name-too-long + *, + test_ids: Optional[str] = None, + states: Optional[Union[str, _models.TriggerState]] = None, + last_modified_start_time: Optional[datetime.datetime] = None, + last_modified_end_time: Optional[datetime.datetime] = None, + maxpagesize: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/triggers" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if test_ids is not None: + _params["testIds"] = _SERIALIZER.query("test_ids", test_ids, "str") + if states is not None: + _params["states"] = _SERIALIZER.query("states", states, "str") + if last_modified_start_time is not None: + _params["lastModifiedStartTime"] = _SERIALIZER.query( + "last_modified_start_time", last_modified_start_time, "iso-8601" + ) + if last_modified_end_time is not None: + _params["lastModifiedEndTime"] = _SERIALIZER.query("last_modified_end_time", last_modified_end_time, "iso-8601") + if maxpagesize is not None: + _params["maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_load_test_administration_create_or_update_notification_rule_request( # pylint: disable=name-too-long + notification_rule_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/notification-rules/{notificationRuleId}" + path_format_arguments = { + "notificationRuleId": _SERIALIZER.url("notification_rule_id", notification_rule_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_load_test_administration_delete_notification_rule_request( # pylint: disable=name-too-long + notification_rule_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/notification-rules/{notificationRuleId}" + path_format_arguments = { + "notificationRuleId": _SERIALIZER.url("notification_rule_id", notification_rule_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_load_test_administration_get_notification_rule_request( # pylint: disable=name-too-long + notification_rule_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/notification-rules/{notificationRuleId}" + path_format_arguments = { + "notificationRuleId": _SERIALIZER.url("notification_rule_id", notification_rule_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_load_test_administration_list_notification_rules_request( # pylint: disable=name-too-long + *, + test_ids: Optional[str] = None, + scopes: Optional[str] = None, + last_modified_start_time: Optional[datetime.datetime] = None, + last_modified_end_time: Optional[datetime.datetime] = None, + maxpagesize: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/notification-rules" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if test_ids is not None: + _params["testIds"] = _SERIALIZER.query("test_ids", test_ids, "str") + if scopes is not None: + _params["scopes"] = _SERIALIZER.query("scopes", scopes, "str") + if last_modified_start_time is not None: + _params["lastModifiedStartTime"] = _SERIALIZER.query( + "last_modified_start_time", last_modified_start_time, "iso-8601" + ) + if last_modified_end_time is not None: + _params["lastModifiedEndTime"] = _SERIALIZER.query("last_modified_end_time", last_modified_end_time, "iso-8601") + if maxpagesize is not None: + _params["maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_load_test_administration_clone_test_request( # pylint: disable=name-too-long + test_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/tests/{testId}:clone" + path_format_arguments = { + "testId": _SERIALIZER.url("test_id", test_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_load_test_administration_get_operation_status_request( # pylint: disable=name-too-long + operation_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/operations/{operationId}" + path_format_arguments = { + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + def build_load_test_run_begin_test_run_request( # pylint: disable=name-too-long test_run_id: str, *, old_test_run_id: Optional[str] = None, **kwargs: Any ) -> HttpRequest: @@ -515,7 +811,7 @@ def build_load_test_run_begin_test_run_request( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -546,7 +842,7 @@ def build_load_test_run_create_or_update_app_components_request( # pylint: disa _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -575,7 +871,7 @@ def build_load_test_run_create_or_update_server_metrics_config_request( # pylin _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("content-type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -603,7 +899,7 @@ def build_load_test_run_delete_test_run_request( # pylint: disable=name-too-lon _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -629,7 +925,7 @@ def build_load_test_run_get_app_components_request( # pylint: disable=name-too- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -655,7 +951,7 @@ def build_load_test_run_get_server_metrics_config_request( # pylint: disable=na _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -679,7 +975,7 @@ def build_load_test_run_get_test_run_request(test_run_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -705,7 +1001,7 @@ def build_load_test_run_get_test_run_file_request( # pylint: disable=name-too-l _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -739,7 +1035,7 @@ def build_load_test_run_list_metric_dimension_values_request( # pylint: disable _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -771,7 +1067,7 @@ def build_load_test_run_get_metric_definitions_request( # pylint: disable=name- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -798,7 +1094,7 @@ def build_load_test_run_get_metric_namespaces_request( # pylint: disable=name-t _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -832,7 +1128,7 @@ def build_load_test_run_list_metrics_request( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -870,12 +1166,13 @@ def build_load_test_run_list_test_runs_request( # pylint: disable=name-too-long execution_to: Optional[datetime.datetime] = None, status: Optional[str] = None, maxpagesize: Optional[int] = None, + created_by_types: Optional[List[str]] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -897,6 +1194,8 @@ def build_load_test_run_list_test_runs_request( # pylint: disable=name-too-long _params["status"] = _SERIALIZER.query("status", status, "str") if maxpagesize is not None: _params["maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") + if created_by_types is not None: + _params["createdByTypes"] = _SERIALIZER.query("created_by_types", created_by_types, "[str]", div=",") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -910,7 +1209,7 @@ def build_load_test_run_stop_test_run_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -937,7 +1236,7 @@ def build_load_test_run_begin_test_profile_run_request( # pylint: disable=name- _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -965,7 +1264,7 @@ def build_load_test_run_delete_test_profile_run_request( # pylint: disable=name _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -991,7 +1290,7 @@ def build_load_test_run_get_test_profile_run_request( # pylint: disable=name-to _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1028,7 +1327,7 @@ def build_load_test_run_list_test_profile_runs_request( # pylint: disable=name- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1071,7 +1370,7 @@ def build_load_test_run_stop_test_profile_run_request( # pylint: disable=name-t _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-12-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -1091,8 +1390,8 @@ def build_load_test_run_stop_test_profile_run_request( # pylint: disable=name-t return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -class LoadTestAdministrationClientOperationsMixin( # pylint: disable=name-too-long - LoadTestAdministrationClientMixinABC +class LoadTestAdministrationClientOperationsMixin( # pylint: disable=too-many-public-methods,name-too-long + ClientMixinABC[PipelineClient, LoadTestAdministrationClientConfiguration] ): @overload @@ -1851,7 +2150,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.TestFileInfo], deserialized["value"]) + list_of_elem = _deserialize(List[_models.TestFileInfo], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -1960,7 +2259,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Test], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Test], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -2556,7 +2855,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.TestProfile], deserialized["value"]) + list_of_elem = _deserialize(List[_models.TestProfile], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -2578,19 +2877,1060 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - -class LoadTestRunClientOperationsMixin(LoadTestRunClientMixinABC): - @overload - def _begin_test_run( + def create_or_update_trigger( self, - test_run_id: str, - body: _models.TestRun, + trigger_id: str, + body: _models.Trigger, *, content_type: str = "application/merge-patch+json", - old_test_run_id: Optional[str] = None, **kwargs: Any - ) -> _models.TestRun: ... + ) -> _models.Trigger: + """Create or update operation template. + + :param trigger_id: The unique identifier of the trigger. Required. + :type trigger_id: str + :param body: The resource instance. Required. + :type body: ~azure.developer.loadtesting.models.Trigger + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: Trigger. The Trigger is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.Trigger + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_trigger( + self, trigger_id: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.Trigger: + """Create or update operation template. + + :param trigger_id: The unique identifier of the trigger. Required. + :type trigger_id: str + :param body: The resource instance. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: Trigger. The Trigger is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.Trigger + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_trigger( + self, trigger_id: str, body: IO[bytes], *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.Trigger: + """Create or update operation template. + + :param trigger_id: The unique identifier of the trigger. Required. + :type trigger_id: str + :param body: The resource instance. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: Trigger. The Trigger is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.Trigger + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update_trigger( + self, trigger_id: str, body: Union[_models.Trigger, JSON, IO[bytes]], **kwargs: Any + ) -> _models.Trigger: + """Create or update operation template. + + :param trigger_id: The unique identifier of the trigger. Required. + :type trigger_id: str + :param body: The resource instance. Is one of the following types: Trigger, JSON, IO[bytes] + Required. + :type body: ~azure.developer.loadtesting.models.Trigger or JSON or IO[bytes] + :return: Trigger. The Trigger is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.Trigger + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) + + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_load_test_administration_create_or_update_trigger_request( + trigger_id=trigger_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Trigger, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete_trigger(self, trigger_id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Resource delete operation template. + + :param trigger_id: The unique identifier of the trigger. Required. + :type trigger_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_load_test_administration_delete_trigger_request( + trigger_id=trigger_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get_trigger(self, trigger_id: str, **kwargs: Any) -> _models.Trigger: + """Resource read operation template. + + :param trigger_id: The unique identifier of the trigger. Required. + :type trigger_id: str + :return: Trigger. The Trigger is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.Trigger + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) + + _request = build_load_test_administration_get_trigger_request( + trigger_id=trigger_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Trigger, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_triggers( + self, + *, + test_ids: Optional[str] = None, + states: Optional[Union[str, _models.TriggerState]] = None, + last_modified_start_time: Optional[datetime.datetime] = None, + last_modified_end_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> Iterable["_models.Trigger"]: + """Resource list operation template. + + :keyword test_ids: Search based on triggers associated with the provided test ids. Default + value is None. + :paramtype test_ids: str + :keyword states: Filter triggers based on a comma separated list of states. Known values are: + "Active", "Paused", "Completed", and "Disabled". Default value is None. + :paramtype states: str or ~azure.developer.loadtesting.models.TriggerState + :keyword last_modified_start_time: Start DateTime(RFC 3339 literal format) of the last updated + time range to filter triggers. Default value is None. + :paramtype last_modified_start_time: ~datetime.datetime + :keyword last_modified_end_time: End DateTime(RFC 3339 literal format) of the last updated time + range to filter triggers. Default value is None. + :paramtype last_modified_end_time: ~datetime.datetime + :return: An iterator like instance of Trigger + :rtype: ~azure.core.paging.ItemPaged[~azure.developer.loadtesting.models.Trigger] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.Trigger]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_load_test_administration_list_triggers_request( + test_ids=test_ids, + states=states, + last_modified_start_time=last_modified_start_time, + last_modified_end_time=last_modified_end_time, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Trigger], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def create_or_update_notification_rule( + self, + notification_rule_id: str, + body: _models.NotificationRule, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.NotificationRule: + """Create or update operation template. + + :param notification_rule_id: The unique identifier of the notification rule. Required. + :type notification_rule_id: str + :param body: The resource instance. Required. + :type body: ~azure.developer.loadtesting.models.NotificationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: NotificationRule. The NotificationRule is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.NotificationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_notification_rule( + self, + notification_rule_id: str, + body: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.NotificationRule: + """Create or update operation template. + + :param notification_rule_id: The unique identifier of the notification rule. Required. + :type notification_rule_id: str + :param body: The resource instance. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: NotificationRule. The NotificationRule is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.NotificationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update_notification_rule( + self, + notification_rule_id: str, + body: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.NotificationRule: + """Create or update operation template. + + :param notification_rule_id: The unique identifier of the notification rule. Required. + :type notification_rule_id: str + :param body: The resource instance. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: NotificationRule. The NotificationRule is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.NotificationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={"2024-12-01-preview": ["api_version", "notification_rule_id", "content_type", "accept"]}, + ) + def create_or_update_notification_rule( + self, notification_rule_id: str, body: Union[_models.NotificationRule, JSON, IO[bytes]], **kwargs: Any + ) -> _models.NotificationRule: + """Create or update operation template. + + :param notification_rule_id: The unique identifier of the notification rule. Required. + :type notification_rule_id: str + :param body: The resource instance. Is one of the following types: NotificationRule, JSON, + IO[bytes] Required. + :type body: ~azure.developer.loadtesting.models.NotificationRule or JSON or IO[bytes] + :return: NotificationRule. The NotificationRule is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.NotificationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NotificationRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_load_test_administration_create_or_update_notification_rule_request( + notification_rule_id=notification_rule_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.NotificationRule, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={"2024-12-01-preview": ["api_version", "notification_rule_id", "accept"]}, + ) + def delete_notification_rule( # pylint: disable=inconsistent-return-statements + self, notification_rule_id: str, **kwargs: Any + ) -> None: + """Resource delete operation template. + + :param notification_rule_id: The unique identifier of the notification rule. Required. + :type notification_rule_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_load_test_administration_delete_notification_rule_request( + notification_rule_id=notification_rule_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={"2024-12-01-preview": ["api_version", "notification_rule_id", "accept"]}, + ) + def get_notification_rule(self, notification_rule_id: str, **kwargs: Any) -> _models.NotificationRule: + """Resource read operation template. + + :param notification_rule_id: The unique identifier of the notification rule. Required. + :type notification_rule_id: str + :return: NotificationRule. The NotificationRule is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.NotificationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NotificationRule] = kwargs.pop("cls", None) + + _request = build_load_test_administration_get_notification_rule_request( + notification_rule_id=notification_rule_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.NotificationRule, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "test_ids", + "scopes", + "last_modified_start_time", + "last_modified_end_time", + "maxpagesize", + "accept", + ] + }, + ) + def list_notification_rules( + self, + *, + test_ids: Optional[str] = None, + scopes: Optional[str] = None, + last_modified_start_time: Optional[datetime.datetime] = None, + last_modified_end_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> Iterable["_models.NotificationRule"]: + """Resource list operation template. + + :keyword test_ids: Search based on notification rules associated with the provided test ids. + Default value is None. + :paramtype test_ids: str + :keyword scopes: Search based on notification rules for the provided scopes. Default value is + None. + :paramtype scopes: str + :keyword last_modified_start_time: Start DateTime(RFC 3339 literal format) of the last updated + time range to filter notification rules. Default value is None. + :paramtype last_modified_start_time: ~datetime.datetime + :keyword last_modified_end_time: End DateTime(RFC 3339 literal format) of the last updated time + range to filter notification rules. Default value is None. + :paramtype last_modified_end_time: ~datetime.datetime + :return: An iterator like instance of NotificationRule + :rtype: ~azure.core.paging.ItemPaged[~azure.developer.loadtesting.models.NotificationRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.NotificationRule]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_load_test_administration_list_notification_rules_request( + test_ids=test_ids, + scopes=scopes, + last_modified_start_time=last_modified_start_time, + last_modified_end_time=last_modified_end_time, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.NotificationRule], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @api_version_validation( + method_added_on="2025-03-01-preview", + params_added_on={"2025-03-01-preview": ["api_version", "test_id", "content_type", "accept"]}, + ) + def _clone_test_initial( + self, + test_id: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + new_test_id: str = _Unset, + display_name: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + if body is _Unset: + if new_test_id is _Unset: + raise TypeError("missing required argument: new_test_id") + body = {"description": description, "displayName": display_name, "newTestId": new_test_id} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_load_test_administration_clone_test_request( + test_id=test_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_clone_test( + self, + test_id: str, + *, + new_test_id: str, + content_type: str = "application/json", + display_name: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.Test]: + """Clone a load test. + + Clone the given test with optional overrides applied to the clone test. + + :param test_id: Unique test identifier for the load test, must contain only lower-case + alphabetic, numeric, underscore or hyphen characters. Required. + :type test_id: str + :keyword new_test_id: Unique identifier for the new test that will be created. Required. + :paramtype new_test_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword display_name: Display Name override for the newly created test. Default value is None. + :paramtype display_name: str + :keyword description: Description override for the newly created test. Default value is None. + :paramtype description: str + :return: An instance of LROPoller that returns Test. The Test is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.developer.loadtesting.models.Test] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_clone_test( + self, test_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.Test]: + """Clone a load test. + + Clone the given test with optional overrides applied to the clone test. + + :param test_id: Unique test identifier for the load test, must contain only lower-case + alphabetic, numeric, underscore or hyphen characters. Required. + :type test_id: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Test. The Test is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.developer.loadtesting.models.Test] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_clone_test( + self, test_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.Test]: + """Clone a load test. + + Clone the given test with optional overrides applied to the clone test. + + :param test_id: Unique test identifier for the load test, must contain only lower-case + alphabetic, numeric, underscore or hyphen characters. Required. + :type test_id: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Test. The Test is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.developer.loadtesting.models.Test] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2025-03-01-preview", + params_added_on={"2025-03-01-preview": ["api_version", "test_id", "content_type", "accept"]}, + ) + def begin_clone_test( + self, + test_id: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + new_test_id: str = _Unset, + display_name: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.Test]: + """Clone a load test. + + Clone the given test with optional overrides applied to the clone test. + + :param test_id: Unique test identifier for the load test, must contain only lower-case + alphabetic, numeric, underscore or hyphen characters. Required. + :type test_id: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword new_test_id: Unique identifier for the new test that will be created. Required. + :paramtype new_test_id: str + :keyword display_name: Display Name override for the newly created test. Default value is None. + :paramtype display_name: str + :keyword description: Description override for the newly created test. Default value is None. + :paramtype description: str + :return: An instance of LROPoller that returns Test. The Test is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.developer.loadtesting.models.Test] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Test] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._clone_test_initial( + test_id=test_id, + body=body, + new_test_id=new_test_id, + display_name=display_name, + description=description, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + + deserialized = _deserialize(_models.Test, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Test].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Test]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + @api_version_validation( + method_added_on="2025-03-01-preview", + params_added_on={"2025-03-01-preview": ["api_version", "operation_id", "accept"]}, + ) + def get_operation_status(self, operation_id: str, **kwargs: Any) -> _models.OperationStatus: + """Get the status of a long running operation. + + Get the status of a long running operation. + + :param operation_id: The unique ID of the operation. Required. + :type operation_id: str + :return: OperationStatus. The OperationStatus is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.OperationStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) + + _request = build_load_test_administration_get_operation_status_request( + operation_id=operation_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OperationStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class LoadTestRunClientOperationsMixin(ClientMixinABC[PipelineClient, LoadTestRunClientConfiguration]): + + @overload + def _begin_test_run( + self, + test_run_id: str, + body: _models.TestRun, + *, + content_type: str = "application/merge-patch+json", + old_test_run_id: Optional[str] = None, + **kwargs: Any + ) -> _models.TestRun: ... @overload def _begin_test_run( self, @@ -3399,7 +4739,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[str], deserialized["value"]) + list_of_elem = _deserialize(List[str], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -3788,7 +5128,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.TimeSeriesElement], deserialized["value"]) + list_of_elem = _deserialize(List[_models.TimeSeriesElement], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -3811,6 +5151,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace + @api_version_validation( + params_added_on={"2024-07-01-preview": ["created_by_types"]}, + ) def list_test_runs( self, *, @@ -3820,6 +5163,7 @@ def list_test_runs( execution_from: Optional[datetime.datetime] = None, execution_to: Optional[datetime.datetime] = None, status: Optional[str] = None, + created_by_types: Optional[List[str]] = None, **kwargs: Any ) -> Iterable["_models.TestRun"]: """Get all test runs for the given filters. @@ -3843,6 +5187,9 @@ def list_test_runs( :paramtype execution_to: ~datetime.datetime :keyword status: Comma separated list of test run status. Default value is None. :paramtype status: str + :keyword created_by_types: Comma separated list of type of entities that have created the test + run. Default value is None. + :paramtype created_by_types: list[str] :return: An iterator like instance of TestRun :rtype: ~azure.core.paging.ItemPaged[~azure.developer.loadtesting.models.TestRun] :raises ~azure.core.exceptions.HttpResponseError: @@ -3872,6 +5219,7 @@ def prepare_request(next_link=None): execution_to=execution_to, status=status, maxpagesize=maxpagesize, + created_by_types=created_by_types, api_version=self._config.api_version, headers=_headers, params=_params, @@ -3903,7 +5251,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.TestRun], deserialized["value"]) + list_of_elem = _deserialize(List[_models.TestRun], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) @@ -4345,7 +5693,7 @@ def prepare_request(next_link=None): def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.TestProfileRun], deserialized["value"]) + list_of_elem = _deserialize(List[_models.TestProfileRun], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, iter(list_of_elem) diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_operations/_patch.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_operations/_patch.py index 026ffb5086c7..8bcb627aa475 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_operations/_patch.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_operations/_patch.py @@ -1,495 +1,15 @@ -# pylint: disable=line-too-long,useless-suppression -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -import logging -import time -from functools import partial -from typing import Any, IO, List, Optional, overload, Union +from typing import List -from azure.core.polling import PollingMethod, LROPoller -from azure.core.tracing.decorator import distributed_trace - -from ._operations import JSON -from ._operations import LoadTestAdministrationClientOperationsMixin as GeneratedAdministrationClientOperations -from ._operations import LoadTestRunClientOperationsMixin as GeneratedRunClientOperations - -from .. import models as _models - -logger = logging.getLogger(__name__) - - -class LoadTestingPollingMethod(PollingMethod): - """Base class for custom sync polling methods.""" - - def _update_status(self) -> None: - raise NotImplementedError("This method needs to be implemented") - - def _update_resource(self) -> None: - self._resource = self._command() - - def initialize(self, client, initial_response, deserialization_callback) -> None: - self._command = client - self._initial_response = initial_response - self._resource = initial_response - - def status(self) -> str: - return self._status - - def finished(self) -> bool: - return self._status in self._termination_statuses - - def resource(self) -> JSON: - return self._resource - - def run(self) -> None: - try: - while not self.finished(): - self._update_resource() - self._update_status() - - if not self.finished(): - time.sleep(self._polling_interval) - except Exception as e: - logger.error(e) - raise e - - -class ValidationCheckPoller(LoadTestingPollingMethod): - """Polling method for long-running file validation operation.""" - - def __init__(self, interval=5) -> None: - self._resource = None - self._command = None - self._initial_response = None - self._polling_interval = interval - self._status = None - self._termination_statuses = [ - "VALIDATION_SUCCESS", - "VALIDATION_FAILURE", - "NOT_VALIDATED", - "VALIDATION_NOT_REQUIRED", - ] - - def _update_status(self) -> None: - self._status = self._resource["validationStatus"] - - -class TestRunStatusPoller(LoadTestingPollingMethod): - """Polling method for polling a Test Run.""" - - def __init__(self, interval=5) -> None: - self._resource = None - self._command = None - self._initial_response = None - self._polling_interval = interval - self._status = None - self._termination_statuses = ["DONE", "FAILED", "CANCELLED"] - - def _update_status(self) -> None: - self._status = self._resource["status"] - - -class TestProfileRunStatusPoller(LoadTestingPollingMethod): - """Polling method for polling a Test Profile Run.""" - - def __init__(self, interval=5) -> None: - self._resource = None - self._command = None - self._initial_response = None - self._polling_interval = interval - self._status = None - self._termination_statuses = ["DONE", "FAILED", "CANCELLED"] - - def _update_status(self): - self._status = self._resource["status"] - - -class LoadTestAdministrationClientOperationsMixin(GeneratedAdministrationClientOperations): - - def __init__(self, *args, **kwargs): - super(LoadTestAdministrationClientOperationsMixin, self).__init__(*args, **kwargs) - - @overload - def begin_upload_test_file( - self, - test_id: str, - file_name: str, - body: bytes, - *, - file_type: Optional[Union[str, _models.FileType]] = None, - **kwargs: Any - ) -> LROPoller[_models.TestFileInfo]: - """Upload input file for a given test Id. File size can't be more than 50 MB. - Existing file with same name for the given test will be overwritten. File - should be provided in the request body as application/octet-stream. - - Upload input file for a given test Id. File size can't be more than 50 MB. - Existing file with same name for the given test will be overwritten. File - should be provided in the request body as application/octet-stream. - - :param test_id: Unique name for the load test, must contain only lower-case alphabetic, - numeric, underscore or hyphen characters. Required. - :type test_id: str - :param file_name: Unique name for test file with file extension like : App.jmx. Required. - :type file_name: str - :param body: The file content as application/octet-stream. Required. - :type body: bytes - :keyword file_type: File type. Known values are: "JMX_FILE", "USER_PROPERTIES", - "ADDITIONAL_ARTIFACTS", "ZIPPED_ARTIFACTS", "URL_TEST_CONFIG", and "TEST_SCRIPT". Default value - is None. - :paramtype file_type: str or ~azure.developer.loadtesting.models.FileType - :return: An instance of LROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestFileInfo`. - :rtype: ~azure.core.polling.LROPoller[~azure.developer.loadtesting.models.TestFileInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_upload_test_file( - self, - test_id: str, - file_name: str, - body: IO, - *, - file_type: Optional[Union[str, _models.FileType]] = None, - **kwargs: Any - ) -> LROPoller[_models.TestFileInfo]: - """Upload input file for a given test Id. File size can't be more than 50 MB. - Existing file with same name for the given test will be overwritten. File - should be provided in the request body as application/octet-stream. - - Upload input file for a given test Id. File size can't be more than 50 MB. - Existing file with same name for the given test will be overwritten. File - should be provided in the request body as application/octet-stream. - - :param test_id: Unique name for the load test, must contain only lower-case alphabetic, - numeric, underscore or hyphen characters. Required. - :type test_id: str - :param file_name: Unique name for test file with file extension like : App.jmx. Required. - :type file_name: str - :param body: The file content as application/octet-stream. Required. - :type body: IO - :keyword file_type: File type. Known values are: "JMX_FILE", "USER_PROPERTIES", - "ADDITIONAL_ARTIFACTS", "ZIPPED_ARTIFACTS", "URL_TEST_CONFIG", and "TEST_SCRIPT". Default value - is None. - :paramtype file_type: str or ~azure.developer.loadtesting.models.FileType - :return: An instance of LROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestFileInfo`. - :rtype: ~azure.core.polling.LROPoller[~azure.developer.loadtesting.models.TestFileInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_upload_test_file( - self, - test_id: str, - file_name: str, - body: Union[IO, bytes], - *, - file_type: Optional[Union[str, _models.FileType]] = None, - **kwargs: Any - ) -> LROPoller[_models.TestFileInfo]: - """Upload input file for a given test Id. File size can't be more than 50 MB. - Existing file with same name for the given test will be overwritten. File - should be provided in the request body as application/octet-stream. - - Upload input file for a given test Id. File size can't be more than 50 MB. - Existing file with same name for the given test will be overwritten. File - should be provided in the request body as application/octet-stream. - - :param test_id: Unique name for the load test, must contain only lower-case alphabetic, - numeric, underscore or hyphen characters. Required. - :type test_id: str - :param file_name: Unique name for test file with file extension like : App.jmx. Required. - :type file_name: str - :param body: The file content as application/octet-stream. Required. - :type body: Is one of the following types: IO, bytes - :keyword file_type: File type. Known values are: "JMX_FILE", "USER_PROPERTIES", - "ADDITIONAL_ARTIFACTS", "ZIPPED_ARTIFACTS", "URL_TEST_CONFIG", and "TEST_SCRIPT". Default value - is None. - :paramtype file_type: str or ~azure.developer.loadtesting.models.FileType - :return: An instance of LROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestFileInfo`. - :rtype: ~azure.core.polling.LROPoller[~azure.developer.loadtesting.models.TestFileInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - polling_interval = kwargs.pop("_polling_interval", None) - if polling_interval is None: - polling_interval = 5 - upload_test_file_operation = super()._begin_upload_test_file( - test_id=test_id, file_name=file_name, file_type=file_type, body=body, **kwargs - ) - - command = partial(self.get_test_file, test_id=test_id, file_name=file_name) - file_validation_status_polling = ValidationCheckPoller(interval=polling_interval) - return LROPoller(command, upload_test_file_operation, lambda *_: None, file_validation_status_polling) - - -class LoadTestRunClientOperationsMixin(GeneratedRunClientOperations): - - def __init__(self, *args, **kwargs): - super(LoadTestRunClientOperationsMixin, self).__init__(*args, **kwargs) - - @overload - def begin_test_run( - self, - test_run_id: str, - body: _models.TestRun, - *, - content_type: str = "application/merge-patch+json", - old_test_run_id: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.TestRun]: - """Create and start a new test run with the given test run Id. - - Create and start a new test run with the given test run Id. - - :param test_run_id: Unique test run identifier for the load test run, must contain only - lower-case alphabetic, numeric, underscore or hyphen characters. Required. - :type test_run_id: str - :param body: The resource instance. Required. - :type body: ~azure.developer.loadtesting.models.TestRun - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is - provided, the - test will run with the JMX file, configuration and app components from the - existing test run. You can override the configuration values for new test run - in the request body. Default value is None. - :paramtype old_test_run_id: str - :return: An instance of LROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestRun`. - :rtype: ~azure.core.polling.LROPoller[~azure.developer.loadtesting.models.TestRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_test_run( - self, - test_run_id: str, - body: JSON, - *, - content_type: str = "application/merge-patch+json", - old_test_run_id: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.TestRun]: - """Create and start a new test run with the given test run Id. - - Create and start a new test run with the given test run Id. - - :param test_run_id: Unique test run identifier for the load test run, must contain only - lower-case alphabetic, numeric, underscore or hyphen characters. Required. - :type test_run_id: str - :param body: The resource instance. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is - provided, the - test will run with the JMX file, configuration and app components from the - existing test run. You can override the configuration values for new test run - in the request body. Default value is None. - :paramtype old_test_run_id: str - :return: An instance of LROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestRun`. - :rtype: ~azure.core.polling.LROPoller[~azure.developer.loadtesting.models.TestRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_test_run( - self, - test_run_id: str, - body: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - old_test_run_id: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.TestRun]: - """Create and start a new test run with the given test run Id. - - Create and start a new test run with the given test run Id. - - :param test_run_id: Unique test run identifier for the load test run, must contain only - lower-case alphabetic, numeric, underscore or hyphen characters. Required. - :type test_run_id: str - :param body: The resource instance. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is - provided, the - test will run with the JMX file, configuration and app components from the - existing test run. You can override the configuration values for new test run - in the request body. Default value is None. - :paramtype old_test_run_id: str - :return: An instance of LROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestRun`. - :rtype: ~azure.core.polling.LROPoller[~azure.developer.loadtesting.models.TestRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_test_run( - self, - test_run_id: str, - body: Union[_models.TestRun, JSON, IO[bytes]], - *, - old_test_run_id: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.TestRun]: - """Create and start a new test run with the given test run Id. - - Create and start a new test run with the given test run Id. - - :param test_run_id: Unique test run identifier for the load test run, must contain only - lower-case alphabetic, numeric, underscore or hyphen characters. Required. - :type test_run_id: str - :param body: The resource instance. Is one of the following types: TestRun, JSON, IO[bytes] - Required. - :type body: ~azure.developer.loadtesting.models.TestRun or JSON or IO[bytes] - :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is - provided, the - test will run with the JMX file, configuration and app components from the - existing test run. You can override the configuration values for new test run - in the request body. Default value is None. - :paramtype old_test_run_id: str - :return: An instance of LROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestRun`. - :rtype: ~azure.core.polling.LROPoller[~azure.developer.loadtesting.models.TestRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - polling_interval = kwargs.pop("_polling_interval", None) - if polling_interval is None: - polling_interval = 5 - - create_or_update_test_run_operation = super()._begin_test_run( - test_run_id, body, old_test_run_id=old_test_run_id, **kwargs - ) - command = partial(self.get_test_run, test_run_id=test_run_id) - - test_run_status_polling = TestRunStatusPoller(interval=polling_interval) - return LROPoller( - command, - create_or_update_test_run_operation, - lambda *_: None, - test_run_status_polling, - ) - - @overload - def begin_test_profile_run( - self, - test_profile_run_id: str, - body: _models.TestProfileRun, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> LROPoller[_models.TestProfileRun]: - """Create and start a new test profile run. - - Create and start a new test profile run with the given test profile run Id. - - :param test_profile_run_id: Unique identifier for the test profile run, must contain only - lower-case alphabetic, numeric, underscore or hyphen characters. Required. - :type test_profile_run_id: str - :param body: The resource instance. Required. - :type body: ~azure.developer.loadtesting.models.TestProfileRun - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: An instance of LROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestProfileRun`. - :rtype: ~azure.core.polling.LROPoller[~azure.developer.loadtesting.models.TestProfileRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_test_profile_run( - self, test_profile_run_id: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> LROPoller[_models.TestProfileRun]: - """Create and start a new test profile run. - - Create and start a new test profile run with the given test profile run Id. - - :param test_profile_run_id: Unique identifier for the test profile run, must contain only - lower-case alphabetic, numeric, underscore or hyphen characters. Required. - :type test_profile_run_id: str - :param body: The resource instance. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: An instance of LROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestProfileRun`. - :rtype: ~azure.core.polling.LROPoller[~azure.developer.loadtesting.models.TestProfileRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_test_profile_run( - self, - test_profile_run_id: str, - body: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> LROPoller[_models.TestProfileRun]: - """Create and start a new test profile run. - - Create and start a new test profile run with the given test profile run Id. - - :param test_profile_run_id: Unique identifier for the test profile run, must contain only - lower-case alphabetic, numeric, underscore or hyphen characters. Required. - :type test_profile_run_id: str - :param body: The resource instance. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: TestProfileRun. The TestProfileRun is compatible with MutableMapping - :return: An instance of LROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestProfileRun`. - :rtype: ~azure.core.polling.LROPoller[~azure.developer.loadtesting.models.TestProfileRun] - """ - - @distributed_trace - def begin_test_profile_run( - self, test_profile_run_id: str, body: Union[_models.TestProfileRun, JSON, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.TestProfileRun]: - """Create and start a new test profile run. - - Create and start a new test profile run with the given test profile run Id. - - :param test_profile_run_id: Unique identifier for the test profile run, must contain only - lower-case alphabetic, numeric, underscore or hyphen characters. Required. - :type test_profile_run_id: str - :param body: The resource instance. Is one of the following types: TestProfileRun, JSON, - IO[bytes] Required. - :type body: ~azure.developer.loadtesting.models.TestProfileRun or JSON or IO[bytes] - :return: An instance of LROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestProfileRun`. - :rtype: ~azure.core.polling.LROPoller[~azure.developer.loadtesting.models.TestProfileRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling_interval = kwargs.pop("_polling_interval", None) - if polling_interval is None: - polling_interval = 5 - create_or_update_test_profile_run_operation = super()._begin_test_profile_run( - test_profile_run_id, body, **kwargs - ) - command = partial(self.get_test_profile_run, test_profile_run_id=test_profile_run_id) - - test_profile_run_status_polling = TestProfileRunStatusPoller(interval=polling_interval) - return LROPoller( - command, - create_or_update_test_profile_run_operation, - lambda *_: None, - test_profile_run_status_polling, - ) - - -# Add all objects you want publicly available to users at this package level -__all__: List[str] = ["LoadTestAdministrationClientOperationsMixin", "LoadTestRunClientOperationsMixin"] +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_patch.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_patch.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_utils/__init__.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_utils/__init__.py new file mode 100644 index 000000000000..8026245c2abc --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_model_base.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_utils/model_base.py similarity index 98% rename from sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_model_base.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_utils/model_base.py index 3072ee252ed9..49d5c7259389 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_model_base.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_utils/model_base.py @@ -2,8 +2,9 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=protected-access, broad-except @@ -21,6 +22,7 @@ from datetime import datetime, date, time, timedelta, timezone from json import JSONEncoder import xml.etree.ElementTree as ET +from collections.abc import MutableMapping from typing_extensions import Self import isodate from azure.core.exceptions import DeserializationError @@ -28,11 +30,6 @@ from azure.core.pipeline import PipelineResponse from azure.core.serialization import _Null -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping - _LOGGER = logging.getLogger(__name__) __all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] @@ -347,7 +344,7 @@ def _get_model(module_name: str, model_name: str): _UNSET = object() -class _MyMutableMapping(MutableMapping[str, typing.Any]): # pylint: disable=unsubscriptable-object +class _MyMutableMapping(MutableMapping[str, typing.Any]): def __init__(self, data: typing.Dict[str, typing.Any]) -> None: self._data = data @@ -407,13 +404,13 @@ def get(self, key: str, default: typing.Any = None) -> typing.Any: return default @typing.overload - def pop(self, key: str) -> typing.Any: ... + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ @typing.overload - def pop(self, key: str, default: _T) -> _T: ... + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs @typing.overload - def pop(self, key: str, default: typing.Any) -> typing.Any: ... + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: """ @@ -443,7 +440,7 @@ def clear(self) -> None: """ self._data.clear() - def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ """ Updates D from mapping/iterable E and F. :param any args: Either a mapping object or an iterable of key-value pairs. @@ -454,7 +451,7 @@ def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: def setdefault(self, key: str, default: None = None) -> None: ... @typing.overload - def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: """ @@ -644,7 +641,7 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") - return super().__new__(cls) # pylint: disable=no-value-for-parameter + return super().__new__(cls) def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: for base in cls.__bases__: @@ -680,7 +677,7 @@ def _deserialize(cls, data, exist_discriminators): discriminator_value = data.find(xml_name).text # pyright: ignore else: discriminator_value = data.get(discriminator._rest_name) - mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member return mapped_cls._deserialize(data, exist_discriminators) def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]: diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_serialization.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_utils/serialization.py similarity index 98% rename from sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_serialization.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_utils/serialization.py index 7a0232de5ddc..eb86ea23c965 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_serialization.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_utils/serialization.py @@ -1,28 +1,10 @@ # pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pyright: reportUnnecessaryTypeIgnoreComment=false diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_vendor.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_utils/utils.py similarity index 50% rename from sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_vendor.py rename to sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_utils/utils.py index 5860e8a7726a..35c9c836f85f 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_vendor.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_utils/utils.py @@ -6,29 +6,20 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import TYPE_CHECKING - -from ._configuration import LoadTestAdministrationClientConfiguration, LoadTestRunClientConfiguration +from typing import Generic, TYPE_CHECKING, TypeVar if TYPE_CHECKING: - from azure.core import PipelineClient - - from ._serialization import Deserializer, Serializer - + from .serialization import Deserializer, Serializer -class LoadTestAdministrationClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - _client: "PipelineClient" - _config: LoadTestAdministrationClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" +TClient = TypeVar("TClient") +TConfig = TypeVar("TConfig") -class LoadTestRunClientMixinABC(ABC): +class ClientMixinABC(ABC, Generic[TClient, TConfig]): """DO NOT use this class. It is for internal typing use only.""" - _client: "PipelineClient" - _config: LoadTestRunClientConfiguration + _client: TClient + _config: TConfig _serialize: "Serializer" _deserialize: "Deserializer" diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_version.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_version.py index a1f432eddc4e..be71c81bd282 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_version.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_client.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_client.py index 20236dba0418..bdd33f4fad9e 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_client.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_client.py @@ -14,7 +14,7 @@ from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import LoadTestAdministrationClientConfiguration, LoadTestRunClientConfiguration from ._operations import LoadTestAdministrationClientOperationsMixin, LoadTestRunClientOperationsMixin @@ -30,14 +30,17 @@ class LoadTestAdministrationClient(LoadTestAdministrationClientOperationsMixin): :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-12-01-preview". Note that overriding this default value may result in unsupported + "2025-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: _endpoint = "https://{endpoint}" self._config = LoadTestAdministrationClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -108,7 +111,7 @@ class LoadTestRunClient(LoadTestRunClientOperationsMixin): :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-12-01-preview". Note that overriding this default value may result in unsupported + "2025-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ @@ -116,6 +119,7 @@ class LoadTestRunClient(LoadTestRunClientOperationsMixin): def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: _endpoint = "https://{endpoint}" self._config = LoadTestRunClientConfiguration(endpoint=endpoint, credential=credential, **kwargs) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_configuration.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_configuration.py index 9a77a5e7a3e4..369ebc2e4562 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_configuration.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_configuration.py @@ -27,13 +27,13 @@ class LoadTestAdministrationClientConfiguration: # pylint: disable=too-many-ins :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-12-01-preview". Note that overriding this default value may result in unsupported + "2025-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-12-01-preview") + api_version: str = kwargs.pop("api_version", "2025-03-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") @@ -75,13 +75,13 @@ class LoadTestRunClientConfiguration: # pylint: disable=too-many-instance-attri :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :keyword api_version: The API version to use for this operation. Default value is - "2024-12-01-preview". Note that overriding this default value may result in unsupported + "2025-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, endpoint: str, credential: "AsyncTokenCredential", **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-12-01-preview") + api_version: str = kwargs.pop("api_version", "2025-03-01-preview") if endpoint is None: raise ValueError("Parameter 'endpoint' must not be None.") diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_operations/_operations.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_operations/_operations.py index f2e638eb48b0..2de31d661bf7 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_operations/_operations.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_operations/_operations.py @@ -6,13 +6,14 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime from io import IOBase import json -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -25,30 +26,41 @@ map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.polling.async_base_polling import AsyncLROBasePolling from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from ... import models as _models -from ..._model_base import SdkJSONEncoder, _deserialize from ..._operations._operations import ( build_load_test_administration_begin_upload_test_file_request, + build_load_test_administration_clone_test_request, build_load_test_administration_create_or_update_app_components_request, + build_load_test_administration_create_or_update_notification_rule_request, build_load_test_administration_create_or_update_server_metrics_config_request, build_load_test_administration_create_or_update_test_profile_request, build_load_test_administration_create_or_update_test_request, + build_load_test_administration_create_or_update_trigger_request, + build_load_test_administration_delete_notification_rule_request, build_load_test_administration_delete_test_file_request, build_load_test_administration_delete_test_profile_request, build_load_test_administration_delete_test_request, + build_load_test_administration_delete_trigger_request, build_load_test_administration_get_app_components_request, + build_load_test_administration_get_notification_rule_request, + build_load_test_administration_get_operation_status_request, build_load_test_administration_get_server_metrics_config_request, build_load_test_administration_get_test_file_request, build_load_test_administration_get_test_profile_request, build_load_test_administration_get_test_request, + build_load_test_administration_get_trigger_request, + build_load_test_administration_list_notification_rules_request, build_load_test_administration_list_test_files_request, build_load_test_administration_list_test_profiles_request, build_load_test_administration_list_tests_request, + build_load_test_administration_list_triggers_request, build_load_test_run_begin_test_profile_run_request, build_load_test_run_begin_test_run_request, build_load_test_run_create_or_update_app_components_request, @@ -69,20 +81,19 @@ build_load_test_run_stop_test_profile_run_request, build_load_test_run_stop_test_run_request, ) +from ..._utils.model_base import SdkJSONEncoder, _deserialize +from ..._utils.utils import ClientMixinABC from ..._validation import api_version_validation -from .._vendor import LoadTestAdministrationClientMixinABC, LoadTestRunClientMixinABC +from .._configuration import LoadTestAdministrationClientConfiguration, LoadTestRunClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] +_Unset: Any = object() T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class LoadTestAdministrationClientOperationsMixin( # pylint: disable=name-too-long - LoadTestAdministrationClientMixinABC +class LoadTestAdministrationClientOperationsMixin( # pylint: disable=too-many-public-methods,name-too-long + ClientMixinABC[AsyncPipelineClient, LoadTestAdministrationClientConfiguration] ): @overload @@ -842,7 +853,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.TestFileInfo], deserialized["value"]) + list_of_elem = _deserialize(List[_models.TestFileInfo], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -951,7 +962,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.Test], deserialized["value"]) + list_of_elem = _deserialize(List[_models.Test], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1544,7 +1555,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.TestProfile], deserialized["value"]) + list_of_elem = _deserialize(List[_models.TestProfile], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -1566,8 +1577,1053 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) + @overload + async def create_or_update_trigger( + self, + trigger_id: str, + body: _models.Trigger, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.Trigger: + """Create or update operation template. + + :param trigger_id: The unique identifier of the trigger. Required. + :type trigger_id: str + :param body: The resource instance. Required. + :type body: ~azure.developer.loadtesting.models.Trigger + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: Trigger. The Trigger is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.Trigger + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_trigger( + self, trigger_id: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.Trigger: + """Create or update operation template. + + :param trigger_id: The unique identifier of the trigger. Required. + :type trigger_id: str + :param body: The resource instance. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: Trigger. The Trigger is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.Trigger + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_trigger( + self, trigger_id: str, body: IO[bytes], *, content_type: str = "application/merge-patch+json", **kwargs: Any + ) -> _models.Trigger: + """Create or update operation template. + + :param trigger_id: The unique identifier of the trigger. Required. + :type trigger_id: str + :param body: The resource instance. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: Trigger. The Trigger is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.Trigger + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update_trigger( + self, trigger_id: str, body: Union[_models.Trigger, JSON, IO[bytes]], **kwargs: Any + ) -> _models.Trigger: + """Create or update operation template. + + :param trigger_id: The unique identifier of the trigger. Required. + :type trigger_id: str + :param body: The resource instance. Is one of the following types: Trigger, JSON, IO[bytes] + Required. + :type body: ~azure.developer.loadtesting.models.Trigger or JSON or IO[bytes] + :return: Trigger. The Trigger is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.Trigger + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) + + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_load_test_administration_create_or_update_trigger_request( + trigger_id=trigger_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Trigger, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete_trigger(self, trigger_id: str, **kwargs: Any) -> None: + """Resource delete operation template. + + :param trigger_id: The unique identifier of the trigger. Required. + :type trigger_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_load_test_administration_delete_trigger_request( + trigger_id=trigger_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get_trigger(self, trigger_id: str, **kwargs: Any) -> _models.Trigger: + """Resource read operation template. + + :param trigger_id: The unique identifier of the trigger. Required. + :type trigger_id: str + :return: Trigger. The Trigger is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.Trigger + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Trigger] = kwargs.pop("cls", None) + + _request = build_load_test_administration_get_trigger_request( + trigger_id=trigger_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Trigger, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_triggers( + self, + *, + test_ids: Optional[str] = None, + states: Optional[Union[str, _models.TriggerState]] = None, + last_modified_start_time: Optional[datetime.datetime] = None, + last_modified_end_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Trigger"]: + """Resource list operation template. + + :keyword test_ids: Search based on triggers associated with the provided test ids. Default + value is None. + :paramtype test_ids: str + :keyword states: Filter triggers based on a comma separated list of states. Known values are: + "Active", "Paused", "Completed", and "Disabled". Default value is None. + :paramtype states: str or ~azure.developer.loadtesting.models.TriggerState + :keyword last_modified_start_time: Start DateTime(RFC 3339 literal format) of the last updated + time range to filter triggers. Default value is None. + :paramtype last_modified_start_time: ~datetime.datetime + :keyword last_modified_end_time: End DateTime(RFC 3339 literal format) of the last updated time + range to filter triggers. Default value is None. + :paramtype last_modified_end_time: ~datetime.datetime + :return: An iterator like instance of Trigger + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.developer.loadtesting.models.Trigger] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.Trigger]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_load_test_administration_list_triggers_request( + test_ids=test_ids, + states=states, + last_modified_start_time=last_modified_start_time, + last_modified_end_time=last_modified_end_time, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Trigger], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def create_or_update_notification_rule( + self, + notification_rule_id: str, + body: _models.NotificationRule, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.NotificationRule: + """Create or update operation template. + + :param notification_rule_id: The unique identifier of the notification rule. Required. + :type notification_rule_id: str + :param body: The resource instance. Required. + :type body: ~azure.developer.loadtesting.models.NotificationRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: NotificationRule. The NotificationRule is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.NotificationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_notification_rule( + self, + notification_rule_id: str, + body: JSON, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.NotificationRule: + """Create or update operation template. + + :param notification_rule_id: The unique identifier of the notification rule. Required. + :type notification_rule_id: str + :param body: The resource instance. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: NotificationRule. The NotificationRule is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.NotificationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update_notification_rule( + self, + notification_rule_id: str, + body: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any + ) -> _models.NotificationRule: + """Create or update operation template. + + :param notification_rule_id: The unique identifier of the notification rule. Required. + :type notification_rule_id: str + :param body: The resource instance. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/merge-patch+json". + :paramtype content_type: str + :return: NotificationRule. The NotificationRule is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.NotificationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={"2024-12-01-preview": ["api_version", "notification_rule_id", "content_type", "accept"]}, + ) + async def create_or_update_notification_rule( + self, notification_rule_id: str, body: Union[_models.NotificationRule, JSON, IO[bytes]], **kwargs: Any + ) -> _models.NotificationRule: + """Create or update operation template. + + :param notification_rule_id: The unique identifier of the notification rule. Required. + :type notification_rule_id: str + :param body: The resource instance. Is one of the following types: NotificationRule, JSON, + IO[bytes] Required. + :type body: ~azure.developer.loadtesting.models.NotificationRule or JSON or IO[bytes] + :return: NotificationRule. The NotificationRule is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.NotificationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.NotificationRule] = kwargs.pop("cls", None) + + content_type = content_type or "application/merge-patch+json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_load_test_administration_create_or_update_notification_rule_request( + notification_rule_id=notification_rule_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.NotificationRule, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={"2024-12-01-preview": ["api_version", "notification_rule_id", "accept"]}, + ) + async def delete_notification_rule(self, notification_rule_id: str, **kwargs: Any) -> None: + """Resource delete operation template. + + :param notification_rule_id: The unique identifier of the notification rule. Required. + :type notification_rule_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_load_test_administration_delete_notification_rule_request( + notification_rule_id=notification_rule_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={"2024-12-01-preview": ["api_version", "notification_rule_id", "accept"]}, + ) + async def get_notification_rule(self, notification_rule_id: str, **kwargs: Any) -> _models.NotificationRule: + """Resource read operation template. + + :param notification_rule_id: The unique identifier of the notification rule. Required. + :type notification_rule_id: str + :return: NotificationRule. The NotificationRule is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.NotificationRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NotificationRule] = kwargs.pop("cls", None) + + _request = build_load_test_administration_get_notification_rule_request( + notification_rule_id=notification_rule_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.NotificationRule, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + @api_version_validation( + method_added_on="2024-12-01-preview", + params_added_on={ + "2024-12-01-preview": [ + "api_version", + "test_ids", + "scopes", + "last_modified_start_time", + "last_modified_end_time", + "maxpagesize", + "accept", + ] + }, + ) + def list_notification_rules( + self, + *, + test_ids: Optional[str] = None, + scopes: Optional[str] = None, + last_modified_start_time: Optional[datetime.datetime] = None, + last_modified_end_time: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> AsyncIterable["_models.NotificationRule"]: + """Resource list operation template. + + :keyword test_ids: Search based on notification rules associated with the provided test ids. + Default value is None. + :paramtype test_ids: str + :keyword scopes: Search based on notification rules for the provided scopes. Default value is + None. + :paramtype scopes: str + :keyword last_modified_start_time: Start DateTime(RFC 3339 literal format) of the last updated + time range to filter notification rules. Default value is None. + :paramtype last_modified_start_time: ~datetime.datetime + :keyword last_modified_end_time: End DateTime(RFC 3339 literal format) of the last updated time + range to filter notification rules. Default value is None. + :paramtype last_modified_end_time: ~datetime.datetime + :return: An iterator like instance of NotificationRule + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.developer.loadtesting.models.NotificationRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + maxpagesize = kwargs.pop("maxpagesize", None) + cls: ClsType[List[_models.NotificationRule]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_load_test_administration_list_notification_rules_request( + test_ids=test_ids, + scopes=scopes, + last_modified_start_time=last_modified_start_time, + last_modified_end_time=last_modified_end_time, + maxpagesize=maxpagesize, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.NotificationRule], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @api_version_validation( + method_added_on="2025-03-01-preview", + params_added_on={"2025-03-01-preview": ["api_version", "test_id", "content_type", "accept"]}, + ) + async def _clone_test_initial( + self, + test_id: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + new_test_id: str = _Unset, + display_name: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + if body is _Unset: + if new_test_id is _Unset: + raise TypeError("missing required argument: new_test_id") + body = {"description": description, "displayName": display_name, "newTestId": new_test_id} + body = {k: v for k, v in body.items() if v is not None} + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_load_test_administration_clone_test_request( + test_id=test_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + response_headers = {} + response_headers["Operation-Location"] = self._deserialize("str", response.headers.get("Operation-Location")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_clone_test( + self, + test_id: str, + *, + new_test_id: str, + content_type: str = "application/json", + display_name: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Test]: + """Clone a load test. + + Clone the given test with optional overrides applied to the clone test. + + :param test_id: Unique test identifier for the load test, must contain only lower-case + alphabetic, numeric, underscore or hyphen characters. Required. + :type test_id: str + :keyword new_test_id: Unique identifier for the new test that will be created. Required. + :paramtype new_test_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword display_name: Display Name override for the newly created test. Default value is None. + :paramtype display_name: str + :keyword description: Description override for the newly created test. Default value is None. + :paramtype description: str + :return: An instance of AsyncLROPoller that returns Test. The Test is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.developer.loadtesting.models.Test] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_clone_test( + self, test_id: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.Test]: + """Clone a load test. + + Clone the given test with optional overrides applied to the clone test. + + :param test_id: Unique test identifier for the load test, must contain only lower-case + alphabetic, numeric, underscore or hyphen characters. Required. + :type test_id: str + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Test. The Test is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.developer.loadtesting.models.Test] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_clone_test( + self, test_id: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.Test]: + """Clone a load test. + + Clone the given test with optional overrides applied to the clone test. + + :param test_id: Unique test identifier for the load test, must contain only lower-case + alphabetic, numeric, underscore or hyphen characters. Required. + :type test_id: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Test. The Test is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.developer.loadtesting.models.Test] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2025-03-01-preview", + params_added_on={"2025-03-01-preview": ["api_version", "test_id", "content_type", "accept"]}, + ) + async def begin_clone_test( + self, + test_id: str, + body: Union[JSON, IO[bytes]] = _Unset, + *, + new_test_id: str = _Unset, + display_name: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.Test]: + """Clone a load test. + + Clone the given test with optional overrides applied to the clone test. + + :param test_id: Unique test identifier for the load test, must contain only lower-case + alphabetic, numeric, underscore or hyphen characters. Required. + :type test_id: str + :param body: Is either a JSON type or a IO[bytes] type. Required. + :type body: JSON or IO[bytes] + :keyword new_test_id: Unique identifier for the new test that will be created. Required. + :paramtype new_test_id: str + :keyword display_name: Display Name override for the newly created test. Default value is None. + :paramtype display_name: str + :keyword description: Description override for the newly created test. Default value is None. + :paramtype description: str + :return: An instance of AsyncLROPoller that returns Test. The Test is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.developer.loadtesting.models.Test] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Test] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._clone_test_initial( + test_id=test_id, + body=body, + new_test_id=new_test_id, + display_name=display_name, + description=description, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Operation-Location"] = self._deserialize( + "str", response.headers.get("Operation-Location") + ) + + deserialized = _deserialize(_models.Test, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncLROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Test].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Test]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + @api_version_validation( + method_added_on="2025-03-01-preview", + params_added_on={"2025-03-01-preview": ["api_version", "operation_id", "accept"]}, + ) + async def get_operation_status(self, operation_id: str, **kwargs: Any) -> _models.OperationStatus: + """Get the status of a long running operation. + + Get the status of a long running operation. + + :param operation_id: The unique ID of the operation. Required. + :type operation_id: str + :return: OperationStatus. The OperationStatus is compatible with MutableMapping + :rtype: ~azure.developer.loadtesting.models.OperationStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) + + _request = build_load_test_administration_get_operation_status_request( + operation_id=operation_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str"), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.OperationStatus, response.json()) -class LoadTestRunClientOperationsMixin(LoadTestRunClientMixinABC): + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class LoadTestRunClientOperationsMixin(ClientMixinABC[AsyncPipelineClient, LoadTestRunClientConfiguration]): @overload async def _begin_test_run( @@ -2387,7 +3443,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[str], deserialized["value"]) + list_of_elem = _deserialize(List[str], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -2780,7 +3836,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.TimeSeriesElement], deserialized["value"]) + list_of_elem = _deserialize(List[_models.TimeSeriesElement], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -2803,6 +3859,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace + @api_version_validation( + params_added_on={"2024-07-01-preview": ["created_by_types"]}, + ) def list_test_runs( self, *, @@ -2812,6 +3871,7 @@ def list_test_runs( execution_from: Optional[datetime.datetime] = None, execution_to: Optional[datetime.datetime] = None, status: Optional[str] = None, + created_by_types: Optional[List[str]] = None, **kwargs: Any ) -> AsyncIterable["_models.TestRun"]: """Get all test runs for the given filters. @@ -2835,6 +3895,9 @@ def list_test_runs( :paramtype execution_to: ~datetime.datetime :keyword status: Comma separated list of test run status. Default value is None. :paramtype status: str + :keyword created_by_types: Comma separated list of type of entities that have created the test + run. Default value is None. + :paramtype created_by_types: list[str] :return: An iterator like instance of TestRun :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.developer.loadtesting.models.TestRun] :raises ~azure.core.exceptions.HttpResponseError: @@ -2864,6 +3927,7 @@ def prepare_request(next_link=None): execution_to=execution_to, status=status, maxpagesize=maxpagesize, + created_by_types=created_by_types, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2895,7 +3959,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.TestRun], deserialized["value"]) + list_of_elem = _deserialize(List[_models.TestRun], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) @@ -3336,7 +4400,7 @@ def prepare_request(next_link=None): async def extract_data(pipeline_response): deserialized = pipeline_response.http_response.json() - list_of_elem = _deserialize(List[_models.TestProfileRun], deserialized["value"]) + list_of_elem = _deserialize(List[_models.TestProfileRun], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.get("nextLink") or None, AsyncList(list_of_elem) diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_operations/_patch.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_operations/_patch.py index 44a11c9f19b8..8bcb627aa475 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_operations/_patch.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_operations/_patch.py @@ -1,499 +1,15 @@ -# pylint: disable=line-too-long,useless-suppression -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -import asyncio -import logging -import time -from functools import partial -from typing import Any, IO, List, Optional, overload, Union +from typing import List -from azure.core.polling import AsyncPollingMethod, AsyncLROPoller -from azure.core.tracing.decorator_async import distributed_trace_async - -from ._operations import JSON -from ._operations import LoadTestAdministrationClientOperationsMixin as GeneratedAdministrationClientOperations -from ._operations import LoadTestRunClientOperationsMixin as GeneratedRunClientOperations - -from ... import models as _models - -logger = logging.getLogger(__name__) - - -class AsyncLoadTestingPollingMethod(AsyncPollingMethod): - """Base class for custom async polling methods.""" - - def _update_status(self) -> None: - raise NotImplementedError("This method needs to be implemented") - - async def _update_resource(self) -> None: - self._resource = await self._command() - - def initialize(self, client, initial_response, deserialization_callback) -> None: - self._command = client - self._initial_response = initial_response - self._resource = initial_response - - def status(self) -> str: - return self._status - - def finished(self) -> bool: - return self._status in self._termination_statuses - - def resource(self) -> JSON: - return self._resource - - async def run(self) -> None: - try: - while not self.finished(): - await self._update_resource() - self._update_status() - - if not self.finished(): - await asyncio.sleep(self._polling_interval) - except Exception as e: - logger.error(e) - raise e - - -class AsyncValidationCheckPoller(AsyncLoadTestingPollingMethod): - def __init__(self, interval=5) -> None: - self._resource = None - self._command = None - self._initial_response = None - self._polling_interval = interval - self._status = None - self._termination_statuses = [ - "VALIDATION_SUCCESS", - "VALIDATION_FAILURE", - "NOT_VALIDATED", - "VALIDATION_NOT_REQUIRED", - ] - - def _update_status(self) -> None: - self._status = self._resource["validationStatus"] - - -class AsyncTestRunStatusPoller(AsyncLoadTestingPollingMethod): - def __init__(self, interval=5) -> None: - self._resource = None - self._command = None - self._initial_response = None - self._polling_interval = interval - self._status = None - self._termination_statuses = ["DONE", "FAILED", "CANCELLED"] - - def _update_status(self) -> None: - self._status = self._resource["status"] - - -class AsyncTestProfileRunStatusPoller(AsyncLoadTestingPollingMethod): - def __init__(self, interval=5) -> None: - self._resource = None - self._command = None - self._initial_response = None - self._polling_interval = interval - self._status = None - self._termination_statuses = ["DONE", "FAILED", "CANCELLED"] - - def _update_status(self) -> None: - self._status = self._resource["status"] - - -class LoadTestAdministrationClientOperationsMixin(GeneratedAdministrationClientOperations): - - def __init__(self, *args, **kwargs): - super(LoadTestAdministrationClientOperationsMixin, self).__init__(*args, **kwargs) - - @overload - async def begin_upload_test_file( - self, - test_id: str, - file_name: str, - body: IO, - *, - file_type: Optional[Union[str, _models.FileType]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.TestFileInfo]: - """Upload input file for a given test Id. File size can't be more than 50 MB. - Existing file with same name for the given test will be overwritten. File - should be provided in the request body as application/octet-stream. - - Upload input file for a given test Id. File size can't be more than 50 MB. - Existing file with same name for the given test will be overwritten. File - should be provided in the request body as application/octet-stream. - - :param test_id: Unique name for the load test, must contain only lower-case alphabetic, - numeric, underscore or hyphen characters. Required. - :type test_id: str - :param file_name: Unique name for test file with file extension like : App.jmx. Required. - :type file_name: str - :param body: The file content as application/octet-stream. Required. - :type body: IO - :keyword file_type: File type. Known values are: "JMX_FILE", "USER_PROPERTIES", - "ADDITIONAL_ARTIFACTS", "ZIPPED_ARTIFACTS", "URL_TEST_CONFIG", and "TEST_SCRIPT". Default value - is None. - :paramtype file_type: str or ~azure.developer.loadtesting.models.FileType - :return: An instance of AsyncLROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestFileInfo`. - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.developer.loadtesting.models.TestFileInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_upload_test_file( - self, - test_id: str, - file_name: str, - body: bytes, - *, - file_type: Optional[Union[str, _models.FileType]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.TestFileInfo]: - """Upload input file for a given test Id. File size can't be more than 50 MB. - Existing file with same name for the given test will be overwritten. File - should be provided in the request body as application/octet-stream. - - Upload input file for a given test Id. File size can't be more than 50 MB. - Existing file with same name for the given test will be overwritten. File - should be provided in the request body as application/octet-stream. - - :param test_id: Unique name for the load test, must contain only lower-case alphabetic, - numeric, underscore or hyphen characters. Required. - :type test_id: str - :param file_name: Unique name for test file with file extension like : App.jmx. Required. - :type file_name: str - :param body: The file content as application/octet-stream. Required. - :type body: bytes - :keyword file_type: File type. Known values are: "JMX_FILE", "USER_PROPERTIES", - "ADDITIONAL_ARTIFACTS", "ZIPPED_ARTIFACTS", "URL_TEST_CONFIG", and "TEST_SCRIPT". Default value - is None. - :paramtype file_type: str or ~azure.developer.loadtesting.models.FileType - :return: An instance of AsyncLROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestFileInfo`. - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.developer.loadtesting.models.TestFileInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_upload_test_file( - self, - test_id: str, - file_name: str, - body: Union[IO, bytes], - *, - file_type: Optional[Union[str, _models.FileType]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.TestFileInfo]: - """Upload input file for a given test Id. File size can't be more than 50 MB. - Existing file with same name for the given test will be overwritten. File - should be provided in the request body as application/octet-stream. - - Upload input file for a given test Id. File size can't be more than 50 MB. - Existing file with same name for the given test will be overwritten. File - should be provided in the request body as application/octet-stream. - - :param test_id: Unique name for the load test, must contain only lower-case alphabetic, - numeric, underscore or hyphen characters. Required. - :type test_id: str - :param file_name: Unique name for test file with file extension like : App.jmx. Required. - :type file_name: str - :param body: The file content as application/octet-stream. Required. - :type body: Is one of the following types: IO, bytes - :keyword file_type: File type. Known values are: "JMX_FILE", "USER_PROPERTIES", - "ADDITIONAL_ARTIFACTS", "ZIPPED_ARTIFACTS", "URL_TEST_CONFIG", and "TEST_SCRIPT". Default value - is None. - :paramtype file_type: str or ~azure.developer.loadtesting.models.FileType - :return: An instance of AsyncLROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestFileInfo`. - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.developer.loadtesting.models.TestFileInfo] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling_interval = kwargs.pop("_polling_interval", None) - if polling_interval is None: - polling_interval = 5 - upload_test_file_operation = await super()._begin_upload_test_file( - test_id=test_id, file_name=file_name, body=body, file_type=file_type, **kwargs - ) - - command = partial(self.get_test_file, test_id=test_id, file_name=file_name) - - file_validation_status_polling = AsyncValidationCheckPoller(interval=polling_interval) - return AsyncLROPoller( - command, - upload_test_file_operation, - lambda *_: None, - file_validation_status_polling, - ) - - -class LoadTestRunClientOperationsMixin(GeneratedRunClientOperations): - - def __init__(self, *args, **kwargs): - super(LoadTestRunClientOperationsMixin).__init__(*args, **kwargs) - - @overload - async def begin_test_run( - self, - test_run_id: str, - body: _models.TestRun, - *, - content_type: str = "application/merge-patch+json", - old_test_run_id: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.TestRun]: - """Create and start a new test run with the given test run Id. - - Create and start a new test run with the given test run Id. - - :param test_run_id: Unique test run identifier for the load test run, must contain only - lower-case alphabetic, numeric, underscore or hyphen characters. Required. - :type test_run_id: str - :param body: The resource instance. Required. - :type body: ~azure.developer.loadtesting.models.TestRun - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is - provided, the - test will run with the JMX file, configuration and app components from the - existing test run. You can override the configuration values for new test run - in the request body. Default value is None. - :paramtype old_test_run_id: str - :return: An instance of AsyncLROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestRun`. - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.developer.loadtesting.models.TestRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_test_run( - self, - test_run_id: str, - body: JSON, - *, - content_type: str = "application/merge-patch+json", - old_test_run_id: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.TestRun]: - """Create and start a new test run with the given test run Id. - - Create and start a new test run with the given test run Id. - - :param test_run_id: Unique test run identifier for the load test run, must contain only - lower-case alphabetic, numeric, underscore or hyphen characters. Required. - :type test_run_id: str - :param body: The resource instance. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is - provided, the - test will run with the JMX file, configuration and app components from the - existing test run. You can override the configuration values for new test run - in the request body. Default value is None. - :paramtype old_test_run_id: str - :return: An instance of AsyncLROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestRun`. - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.developer.loadtesting.models.TestRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_test_run( - self, - test_run_id: str, - body: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - old_test_run_id: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.TestRun]: - """Create and start a new test run with the given test run Id. - - Create and start a new test run with the given test run Id. - - :param test_run_id: Unique test run identifier for the load test run, must contain only - lower-case alphabetic, numeric, underscore or hyphen characters. Required. - :type test_run_id: str - :param body: The resource instance. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is - provided, the - test will run with the JMX file, configuration and app components from the - existing test run. You can override the configuration values for new test run - in the request body. Default value is None. - :paramtype old_test_run_id: str - :return: An instance of AsyncLROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestRun`. - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.developer.loadtesting.models.TestRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_test_run( - self, - test_run_id: str, - body: Union[_models.TestRun, JSON, IO[bytes]], - *, - old_test_run_id: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.TestRun]: - """Create and start a new test run with the given test run Id. - - Create and start a new test run with the given test run Id. - - :param test_run_id: Unique test run identifier for the load test run, must contain only - lower-case alphabetic, numeric, underscore or hyphen characters. Required. - :type test_run_id: str - :param body: The resource instance. Is one of the following types: TestRun, JSON, IO[bytes] - Required. - :type body: ~azure.developer.loadtesting.models.TestRun or JSON or IO[bytes] - :keyword old_test_run_id: Existing test run identifier that should be rerun, if this is - provided, the - test will run with the JMX file, configuration and app components from the - existing test run. You can override the configuration values for new test run - in the request body. Default value is None. - :paramtype old_test_run_id: str - :return: An instance of AsyncLROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestRun`. - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.developer.loadtesting.models.TestRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling_interval = kwargs.pop("_polling_interval", None) - if polling_interval is None: - polling_interval = 5 - - create_or_update_test_run_operation = await super()._begin_test_run( - test_run_id, body, old_test_run_id=old_test_run_id, **kwargs - ) - - command = partial(self.get_test_run, test_run_id=test_run_id) - - test_run_status_polling = AsyncTestRunStatusPoller(interval=polling_interval) - - return AsyncLROPoller( - command, - create_or_update_test_run_operation, - lambda *_: None, - test_run_status_polling, - ) - - @overload - async def begin_test_profile_run( - self, - test_profile_run_id: str, - body: _models.TestProfileRun, - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> AsyncLROPoller[_models.TestProfileRun]: - """Create and start a new test profile run. - - Create and start a new test profile run with the given test profile run Id. - - :param test_profile_run_id: Unique identifier for the test profile run, must contain only - lower-case alphabetic, numeric, underscore or hyphen characters. Required. - :type test_profile_run_id: str - :param body: The resource instance. Required. - :type body: ~azure.developer.loadtesting.models.TestProfileRun - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestProfileRun`. - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.developer.loadtesting.models.TestProfileRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_test_profile_run( - self, test_profile_run_id: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any - ) -> AsyncLROPoller[_models.TestProfileRun]: - """Create and start a new test profile run. - - Create and start a new test profile run with the given test profile run Id. - - :param test_profile_run_id: Unique identifier for the test profile run, must contain only - lower-case alphabetic, numeric, underscore or hyphen characters. Required. - :type test_profile_run_id: str - :param body: The resource instance. Required. - :type body: JSON - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestProfileRun`. - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.developer.loadtesting.models.TestProfileRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_test_profile_run( - self, - test_profile_run_id: str, - body: IO[bytes], - *, - content_type: str = "application/merge-patch+json", - **kwargs: Any - ) -> AsyncLROPoller[_models.TestProfileRun]: - """Create and start a new test profile run. - - Create and start a new test profile run with the given test profile run Id. - - :param test_profile_run_id: Unique identifier for the test profile run, must contain only - lower-case alphabetic, numeric, underscore or hyphen characters. Required. - :type test_profile_run_id: str - :param body: The resource instance. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/merge-patch+json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestProfileRun`. - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.developer.loadtesting.models.TestProfileRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_test_profile_run( - self, test_profile_run_id: str, body: Union[_models.TestProfileRun, JSON, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.TestProfileRun]: - """Create and start a new test profile run. - - Create and start a new test profile run with the given test profile run Id. - - :param test_profile_run_id: Unique identifier for the test profile run, must contain only - lower-case alphabetic, numeric, underscore or hyphen characters. Required. - :type test_profile_run_id: str - :param body: The resource instance. Is one of the following types: TestProfileRun, JSON, - IO[bytes] Required. - :type body: ~azure.developer.loadtesting.models.TestProfileRun or JSON or IO[bytes] - :return: An instance of AsyncLROPoller. Call `result()` on the poller object to return a :class:`~azure.developer.loadtesting.models.TestProfileRun`. - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.developer.loadtesting.models.TestProfileRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling_interval = kwargs.pop("_polling_interval", None) - - if polling_interval is None: - polling_interval = 5 - - create_or_update_test_profile_run_operation = await super()._begin_test_profile_run( - test_profile_run_id, body, **kwargs - ) - - command = partial(self.get_test_profile_run, test_profile_run_id=test_profile_run_id) - - test_profile_run_status_polling = AsyncTestProfileRunStatusPoller(interval=polling_interval) - return AsyncLROPoller( - command, - create_or_update_test_profile_run_operation, - lambda *_: None, - test_profile_run_status_polling, - ) - - -# Add all objects you want publicly available to users at this package level -__all__: List[str] = ["LoadTestAdministrationClientOperationsMixin", "LoadTestRunClientOperationsMixin"] +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_patch.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_patch.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_vendor.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_vendor.py deleted file mode 100644 index cc211a4758bb..000000000000 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/aio/_vendor.py +++ /dev/null @@ -1,34 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) Python Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import TYPE_CHECKING - -from ._configuration import LoadTestAdministrationClientConfiguration, LoadTestRunClientConfiguration - -if TYPE_CHECKING: - from azure.core import AsyncPipelineClient - - from .._serialization import Deserializer, Serializer - - -class LoadTestAdministrationClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "AsyncPipelineClient" - _config: LoadTestAdministrationClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" - - -class LoadTestRunClientMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "AsyncPipelineClient" - _config: LoadTestRunClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/models/__init__.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/models/__init__.py index 6e644e25a518..72f1d2e170b9 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/models/__init__.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/models/__init__.py @@ -18,11 +18,13 @@ ArtifactsContainerInfo, AutoStopCriteria, CertificateMetadata, + DailyRecurrence, DimensionFilter, DimensionValue, ErrorDetails, FunctionFlexConsumptionResourceConfiguration, FunctionFlexConsumptionTargetResourceConfigurations, + HourlyRecurrence, LoadTestConfiguration, MetricAvailability, MetricDefinition, @@ -31,14 +33,24 @@ MetricNamespaceCollection, MetricRequestPayload, MetricValue, + MonthlyRecurrenceByDates, + MonthlyRecurrenceByWeekDays, NameAndDescription, + NotificationRule, + OperationStatus, OptionalLoadTestConfiguration, PassFailCriteria, PassFailMetric, PassFailServerMetric, + Recurrence, + RecurrenceEnd, + RecurrenceStatus, + RecurrenceWithCron, RegionalConfiguration, ResourceMetric, + ScheduleTestsTrigger, Secret, + StateDetails, TargetResourceConfigurations, Test, TestAppComponents, @@ -51,13 +63,22 @@ TestRunAppComponents, TestRunArtifacts, TestRunDetail, + TestRunEndedEventCondition, + TestRunEndedNotificationEventFilter, TestRunFileInfo, TestRunInputArtifacts, TestRunOutputArtifacts, TestRunServerMetricsConfiguration, + TestRunStartedNotificationEventFilter, TestRunStatistics, TestServerMetricsConfiguration, + TestsNotificationEventFilter, + TestsNotificationRule, TimeSeriesElement, + Trigger, + TriggerCompletedNotificationEventFilter, + TriggerDisabledNotificationEventFilter, + WeeklyRecurrence, ) from ._enums import ( # type: ignore @@ -66,8 +87,13 @@ CreatedByType, FileType, FileValidationStatus, + Frequency, ManagedIdentityType, MetricUnit, + NotificationEventType, + NotificationScopeType, + OperationKind, + OperationState, PFMetrics, PassFailAction, PassFailAggregationFunction, @@ -81,6 +107,9 @@ TestProfileRunStatus, TestRunStatus, TimeGrain, + TriggerState, + TriggerType, + WeekDays, ) from ._patch import __all__ as _patch_all from ._patch import * @@ -91,11 +120,13 @@ "ArtifactsContainerInfo", "AutoStopCriteria", "CertificateMetadata", + "DailyRecurrence", "DimensionFilter", "DimensionValue", "ErrorDetails", "FunctionFlexConsumptionResourceConfiguration", "FunctionFlexConsumptionTargetResourceConfigurations", + "HourlyRecurrence", "LoadTestConfiguration", "MetricAvailability", "MetricDefinition", @@ -104,14 +135,24 @@ "MetricNamespaceCollection", "MetricRequestPayload", "MetricValue", + "MonthlyRecurrenceByDates", + "MonthlyRecurrenceByWeekDays", "NameAndDescription", + "NotificationRule", + "OperationStatus", "OptionalLoadTestConfiguration", "PassFailCriteria", "PassFailMetric", "PassFailServerMetric", + "Recurrence", + "RecurrenceEnd", + "RecurrenceStatus", + "RecurrenceWithCron", "RegionalConfiguration", "ResourceMetric", + "ScheduleTestsTrigger", "Secret", + "StateDetails", "TargetResourceConfigurations", "Test", "TestAppComponents", @@ -124,20 +165,34 @@ "TestRunAppComponents", "TestRunArtifacts", "TestRunDetail", + "TestRunEndedEventCondition", + "TestRunEndedNotificationEventFilter", "TestRunFileInfo", "TestRunInputArtifacts", "TestRunOutputArtifacts", "TestRunServerMetricsConfiguration", + "TestRunStartedNotificationEventFilter", "TestRunStatistics", "TestServerMetricsConfiguration", + "TestsNotificationEventFilter", + "TestsNotificationRule", "TimeSeriesElement", + "Trigger", + "TriggerCompletedNotificationEventFilter", + "TriggerDisabledNotificationEventFilter", + "WeeklyRecurrence", "Aggregation", "CertificateType", "CreatedByType", "FileType", "FileValidationStatus", + "Frequency", "ManagedIdentityType", "MetricUnit", + "NotificationEventType", + "NotificationScopeType", + "OperationKind", + "OperationState", "PFMetrics", "PassFailAction", "PassFailAggregationFunction", @@ -151,6 +206,9 @@ "TestProfileRunStatus", "TestRunStatus", "TimeGrain", + "TriggerState", + "TriggerType", + "WeekDays", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/models/_enums.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/models/_enums.py index f6ecc0080712..ec99dd420d67 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/models/_enums.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/models/_enums.py @@ -55,6 +55,10 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Entity was created by a user.""" SCHEDULED_TRIGGER = "ScheduledTrigger" """Entity was created by a scheduled trigger.""" + AZURE_PIPELINES = "AzurePipelines" + """Entity was created by Azure DevOps pipelines.""" + GIT_HUB_WORKFLOWS = "GitHubWorkflows" + """Entity was created by GitHub Workflows.""" class FileType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -89,6 +93,23 @@ class FileValidationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Validation is not required.""" +class Frequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Frequency of recurrence for a trigger.""" + + CRON = "Cron" + """Recurrence defined by a cron expression.""" + HOURLY = "Hourly" + """Recurrence defined on an hourly basis, as specified by HourlyRecurrence.""" + DAILY = "Daily" + """Recurrence defined on a daily basis, as specified by DailyRecurrence.""" + WEEKLY = "Weekly" + """Recurrence defined on a weekly basis, as specified by WeeklyRecurrence.""" + MONTHLY_BY_DAYS = "MonthlyByDays" + """Recurrence defined monthly on specific days, as specified by MonthlyRecurrenceByWeekDays.""" + MONTHLY_BY_DATES = "MonthlyByDates" + """Recurrence defined monthly on specific dates, as specified by MonthlyRecurrenceByDates.""" + + class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Managed identity type.""" @@ -119,6 +140,48 @@ class MetricUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Count per second""" +class NotificationEventType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Notification event type.""" + + TEST_RUN_ENDED = "TestRunEnded" + """Test run ended event. This event would occur when a test run reaches terminal state.""" + TEST_RUN_STARTED = "TestRunStarted" + """Test run started event. This event would occur when a new test run is triggered.""" + TRIGGER_COMPLETED = "TriggerCompleted" + """Trigger completed event. This event would occur when a trigger completes.""" + TRIGGER_DISABLED = "TriggerDisabled" + """Trigger disabled event. This event would occur when a trigger is disabled.""" + + +class NotificationScopeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Scope type of a notification rule.""" + + TESTS = "Tests" + """Notification rule is for Tests.""" + + +class OperationKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Kind of the long running operation.""" + + CLONE_TEST = "CloneTest" + """Operation represents a clone test operation""" + + +class OperationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum describing allowed operation states.""" + + NOT_STARTED = "NotStarted" + """The operation has not started.""" + RUNNING = "Running" + """The operation is in progress.""" + SUCCEEDED = "Succeeded" + """The operation has completed successfully.""" + FAILED = "Failed" + """The operation has failed.""" + CANCELED = "Canceled" + """The operation has been canceled by the user.""" + + class PassFailAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Action to take on failure of pass/fail criteria.""" @@ -315,3 +378,42 @@ class TimeGrain(str, Enum, metaclass=CaseInsensitiveEnumMeta): """5 minutes, available only if test run duration is greater than 1 minute.""" PT1H = "PT1H" """1 hour, available only if test run duration is greater than 1 minute.""" + + +class TriggerState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Current state of a trigger.""" + + ACTIVE = "Active" + """The trigger is active.""" + PAUSED = "Paused" + """The trigger is paused manually.""" + COMPLETED = "Completed" + """The trigger is completed.""" + DISABLED = "Disabled" + """The trigger is disabled due to error.""" + + +class TriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of a trigger.""" + + SCHEDULE_TESTS_TRIGGER = "ScheduleTestsTrigger" + """Trigger is a Scheduled Trigger on a Test.""" + + +class WeekDays(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Defines the days of the week.""" + + SUNDAY = "Sunday" + """Refers to Sunday.""" + MONDAY = "Monday" + """Refers to Monday.""" + TUESDAY = "Tuesday" + """Refers to Tuesday.""" + WEDNESDAY = "Wednesday" + """Refers to Wednesday.""" + THURSDAY = "Thursday" + """Refers to Thursday.""" + FRIDAY = "Friday" + """Refers to Friday.""" + SATURDAY = "Saturday" + """Refers to Saturday.""" diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/models/_models.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/models/_models.py index 32acdef7a137..236877db15b6 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/models/_models.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/models/_models.py @@ -11,15 +11,16 @@ import datetime from typing import Any, Dict, List, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload -from .. import _model_base -from .._model_base import rest_discriminator, rest_field -from ._enums import ResourceKind +from azure.core.exceptions import ODataV4Format + +from .._utils.model_base import Model as _Model, rest_discriminator, rest_field +from ._enums import Frequency, NotificationEventType, NotificationScopeType, ResourceKind, TriggerType if TYPE_CHECKING: from .. import models as _models -class AppComponent(_model_base.Model): +class AppComponent(_Model): """An Azure resource object (Refer azure generic resource model :`https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id#genericresource `_). @@ -82,7 +83,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ArtifactsContainerInfo(_model_base.Model): +class ArtifactsContainerInfo(_Model): """Artifacts container info. :ivar url: This is a SAS URI to an Azure Storage Container that contains the test run @@ -118,7 +119,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class AutoStopCriteria(_model_base.Model): +class AutoStopCriteria(_Model): """Auto stop criteria for a test. This will automatically stop a load test if the error percentage is high for a certain time window. @@ -130,6 +131,9 @@ class AutoStopCriteria(_model_base.Model): :ivar error_rate_time_window_in_seconds: Time window during which the error percentage should be evaluated in seconds. :vartype error_rate_time_window_in_seconds: int + :ivar maximum_virtual_users_per_engine: Maximum number of virtual users per load testing + engine, at which the test run should be automatically stopped. + :vartype maximum_virtual_users_per_engine: int """ auto_stop_disabled: Optional[bool] = rest_field( @@ -145,6 +149,11 @@ class AutoStopCriteria(_model_base.Model): name="errorRateTimeWindowInSeconds", visibility=["read", "create", "update", "delete", "query"] ) """Time window during which the error percentage should be evaluated in seconds.""" + maximum_virtual_users_per_engine: Optional[int] = rest_field( + name="maximumVirtualUsersPerEngine", visibility=["read", "create", "update", "delete", "query"] + ) + """Maximum number of virtual users per load testing engine, at which the test run should be + automatically stopped.""" @overload def __init__( @@ -153,6 +162,7 @@ def __init__( auto_stop_disabled: Optional[bool] = None, error_rate: Optional[float] = None, error_rate_time_window_in_seconds: Optional[int] = None, + maximum_virtual_users_per_engine: Optional[int] = None, ) -> None: ... @overload @@ -166,7 +176,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class CertificateMetadata(_model_base.Model): +class CertificateMetadata(_Model): """Certificates metadata. :ivar value: The value of the certificate for respective type. @@ -206,7 +216,100 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DimensionFilter(_model_base.Model): +class Recurrence(_Model): + """Recurrence model. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + RecurrenceWithCron, DailyRecurrence, HourlyRecurrence, MonthlyRecurrenceByDates, + MonthlyRecurrenceByWeekDays, WeeklyRecurrence + + :ivar frequency: Frequency of the recurrence. Required. Known values are: "Cron", "Hourly", + "Daily", "Weekly", "MonthlyByDays", and "MonthlyByDates". + :vartype frequency: str or ~azure.developer.loadtesting.models.Frequency + :ivar recurrence_end: Recurrence end model. You can specify the end either by providing a + numberOfOccurrences (which will end the recurrence after the specified number of occurrences) + or by providing an endDateTime (which will end the recurrence after the specified date). If + neither value is provided, the recurrence will continue until it is manually ended. However, if + both values are provided, an error will be thrown. + :vartype recurrence_end: ~azure.developer.loadtesting.models.RecurrenceEnd + """ + + __mapping__: Dict[str, _Model] = {} + frequency: str = rest_discriminator(name="frequency", visibility=["read", "create", "update", "delete", "query"]) + """Frequency of the recurrence. Required. Known values are: \"Cron\", \"Hourly\", \"Daily\", + \"Weekly\", \"MonthlyByDays\", and \"MonthlyByDates\".""" + recurrence_end: Optional["_models.RecurrenceEnd"] = rest_field( + name="recurrenceEnd", visibility=["read", "create", "update", "delete", "query"] + ) + """Recurrence end model. You can specify the end either by providing a numberOfOccurrences (which + will end the recurrence after the specified number of occurrences) or by providing an + endDateTime (which will end the recurrence after the specified date). If neither value is + provided, the recurrence will continue until it is manually ended. However, if both values are + provided, an error will be thrown.""" + + @overload + def __init__( + self, + *, + frequency: str, + recurrence_end: Optional["_models.RecurrenceEnd"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DailyRecurrence(Recurrence, discriminator="Daily"): + """Recurrence model when frequency is set as Daily. + + :ivar recurrence_end: Recurrence end model. You can specify the end either by providing a + numberOfOccurrences (which will end the recurrence after the specified number of occurrences) + or by providing an endDateTime (which will end the recurrence after the specified date). If + neither value is provided, the recurrence will continue until it is manually ended. However, if + both values are provided, an error will be thrown. + :vartype recurrence_end: ~azure.developer.loadtesting.models.RecurrenceEnd + :ivar frequency: Frequency of the day recurrence. Required. Recurrence defined on a daily + basis, as specified by DailyRecurrence. + :vartype frequency: str or ~azure.developer.loadtesting.models.DAILY + :ivar interval: The interval at which the recurrence should repeat. It signifies the number of + days between each recurrence. Required. + :vartype interval: int + """ + + frequency: Literal[Frequency.DAILY] = rest_discriminator(name="frequency", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Frequency of the day recurrence. Required. Recurrence defined on a daily basis, as specified by + DailyRecurrence.""" + interval: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The interval at which the recurrence should repeat. It signifies the number of days between + each recurrence. Required.""" + + @overload + def __init__( + self, + *, + interval: int, + recurrence_end: Optional["_models.RecurrenceEnd"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, frequency=Frequency.DAILY, **kwargs) + + +class DimensionFilter(_Model): """Dimension name and values to filter. :ivar name: The dimension name. @@ -241,7 +344,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class DimensionValue(_model_base.Model): +class DimensionValue(_Model): """Represents a metric dimension value. :ivar name: The name of the dimension. @@ -274,7 +377,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class ErrorDetails(_model_base.Model): +class ErrorDetails(_Model): """Error details if there is any failure in load test run. :ivar message: Error details in case test run was not successfully run. @@ -285,7 +388,7 @@ class ErrorDetails(_model_base.Model): """Error details in case test run was not successfully run.""" -class FunctionFlexConsumptionResourceConfiguration(_model_base.Model): # pylint: disable=name-too-long +class FunctionFlexConsumptionResourceConfiguration(_Model): # pylint: disable=name-too-long """Resource configuration instance for a Flex Consumption based Azure Function App. :ivar instance_memory_mb: Memory size of the instance. Supported values are 2048, 4096. @@ -323,7 +426,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TargetResourceConfigurations(_model_base.Model): +class TargetResourceConfigurations(_Model): """Configurations of a target resource. This varies with the kind of resource. You probably want to use the sub-classes and not this class directly. Known sub-classes are: @@ -334,7 +437,7 @@ class TargetResourceConfigurations(_model_base.Model): :vartype kind: str or ~azure.developer.loadtesting.models.ResourceKind """ - __mapping__: Dict[str, _model_base.Model] = {} + __mapping__: Dict[str, _Model] = {} kind: str = rest_discriminator(name="kind", visibility=["read", "create"]) """Kind of the resource for which the configurations apply. Required. \"FunctionsFlexConsumption\"""" @@ -397,7 +500,50 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, kind=ResourceKind.FUNCTIONS_FLEX_CONSUMPTION, **kwargs) -class LoadTestConfiguration(_model_base.Model): +class HourlyRecurrence(Recurrence, discriminator="Hourly"): + """Recurrence model when frequency is set as Hourly. + + :ivar recurrence_end: Recurrence end model. You can specify the end either by providing a + numberOfOccurrences (which will end the recurrence after the specified number of occurrences) + or by providing an endDateTime (which will end the recurrence after the specified date). If + neither value is provided, the recurrence will continue until it is manually ended. However, if + both values are provided, an error will be thrown. + :vartype recurrence_end: ~azure.developer.loadtesting.models.RecurrenceEnd + :ivar frequency: Frequency of the hour recurrence. Required. Recurrence defined on an hourly + basis, as specified by HourlyRecurrence. + :vartype frequency: str or ~azure.developer.loadtesting.models.HOURLY + :ivar interval: The interval at which the recurrence should repeat. It signifies the number of + hours between each recurrence. Required. + :vartype interval: int + """ + + frequency: Literal[Frequency.HOURLY] = rest_discriminator(name="frequency", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Frequency of the hour recurrence. Required. Recurrence defined on an hourly basis, as specified + by HourlyRecurrence.""" + interval: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The interval at which the recurrence should repeat. It signifies the number of hours between + each recurrence. Required.""" + + @overload + def __init__( + self, + *, + interval: int, + recurrence_end: Optional["_models.RecurrenceEnd"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, frequency=Frequency.HOURLY, **kwargs) + + +class LoadTestConfiguration(_Model): """Configurations for the load test. :ivar engine_instances: The number of engine instances to execute load test. Supported values @@ -469,7 +615,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MetricAvailability(_model_base.Model): +class MetricAvailability(_Model): """Metric availability specifies the time grain (aggregation interval or frequency). :ivar time_grain: The time grain specifies the aggregation interval for the metric. Expressed @@ -503,7 +649,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MetricDefinition(_model_base.Model): +class MetricDefinition(_Model): """Metric definition. :ivar dimensions: List of dimensions. @@ -587,7 +733,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MetricDefinitionCollection(_model_base.Model): +class MetricDefinitionCollection(_Model): """Represents collection of metric definitions. :ivar value: the values for the metric definitions. Required. @@ -615,7 +761,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MetricNamespace(_model_base.Model): +class MetricNamespace(_Model): """Metric namespace class specifies the metadata for a metric namespace. :ivar description: The namespace description. @@ -648,7 +794,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MetricNamespaceCollection(_model_base.Model): +class MetricNamespaceCollection(_Model): """Represents collection of metric namespaces. :ivar value: The values for the metric namespaces. Required. @@ -676,7 +822,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MetricRequestPayload(_model_base.Model): +class MetricRequestPayload(_Model): """Filters to fetch the set of metric. :ivar filters: Get metrics for specific dimension values. Example: Metric contains dimension @@ -712,7 +858,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class MetricValue(_model_base.Model): +class MetricValue(_Model): """Represents a metric value. :ivar timestamp: The timestamp for the metric value in RFC 3339 format. @@ -747,7 +893,120 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class NameAndDescription(_model_base.Model): +class MonthlyRecurrenceByDates(Recurrence, discriminator="MonthlyByDates"): + """Recurrence model when frequency is set as MonthlyByDates. + + :ivar recurrence_end: Recurrence end model. You can specify the end either by providing a + numberOfOccurrences (which will end the recurrence after the specified number of occurrences) + or by providing an endDateTime (which will end the recurrence after the specified date). If + neither value is provided, the recurrence will continue until it is manually ended. However, if + both values are provided, an error will be thrown. + :vartype recurrence_end: ~azure.developer.loadtesting.models.RecurrenceEnd + :ivar frequency: Frequency of the month recurrence. Required. Recurrence defined monthly on + specific dates, as specified by MonthlyRecurrenceByDates. + :vartype frequency: str or ~azure.developer.loadtesting.models.MONTHLY_BY_DATES + :ivar dates_in_month: Recurrence set to repeat on the specified dates of the month. Value of + dates can be 1 to 31 and -1. -1 represents the last day of the month. + :vartype dates_in_month: list[int] + :ivar interval: The interval at which the recurrence should repeat. It signifies the number of + months between each recurrence. + :vartype interval: int + """ + + frequency: Literal[Frequency.MONTHLY_BY_DATES] = rest_discriminator(name="frequency", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Frequency of the month recurrence. Required. Recurrence defined monthly on specific dates, as + specified by MonthlyRecurrenceByDates.""" + dates_in_month: Optional[List[int]] = rest_field( + name="datesInMonth", visibility=["read", "create", "update", "delete", "query"] + ) + """Recurrence set to repeat on the specified dates of the month. Value of dates can be 1 to 31 and + -1. -1 represents the last day of the month.""" + interval: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The interval at which the recurrence should repeat. It signifies the number of months between + each recurrence.""" + + @overload + def __init__( + self, + *, + recurrence_end: Optional["_models.RecurrenceEnd"] = None, + dates_in_month: Optional[List[int]] = None, + interval: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, frequency=Frequency.MONTHLY_BY_DATES, **kwargs) + + +class MonthlyRecurrenceByWeekDays(Recurrence, discriminator="MonthlyByDays"): + """Recurrence model when frequency is set as MonthlyByDays . + + :ivar recurrence_end: Recurrence end model. You can specify the end either by providing a + numberOfOccurrences (which will end the recurrence after the specified number of occurrences) + or by providing an endDateTime (which will end the recurrence after the specified date). If + neither value is provided, the recurrence will continue until it is manually ended. However, if + both values are provided, an error will be thrown. + :vartype recurrence_end: ~azure.developer.loadtesting.models.RecurrenceEnd + :ivar frequency: Frequency of the month recurrence. Required. Recurrence defined monthly on + specific days, as specified by MonthlyRecurrenceByWeekDays. + :vartype frequency: str or ~azure.developer.loadtesting.models.MONTHLY_BY_DAYS + :ivar week_days_in_month: Specific days of the week when the recurrence should repeat. + :vartype week_days_in_month: list[str or ~azure.developer.loadtesting.models.WeekDays] + :ivar index: Index of the week in a month at which the recurrence should repeat. For example, + if the index is '2', weekDay is 'Monday', interval is 3 and frequency is 'Month', the + recurrence will run every second Monday of the month and repeat every 3 months. Value of index + can be 1 to 5. Required. + :vartype index: int + :ivar interval: The interval at which the recurrence should repeat. It signifies the number of + months between each recurrence. Required. + :vartype interval: int + """ + + frequency: Literal[Frequency.MONTHLY_BY_DAYS] = rest_discriminator(name="frequency", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Frequency of the month recurrence. Required. Recurrence defined monthly on specific days, as + specified by MonthlyRecurrenceByWeekDays.""" + week_days_in_month: Optional[List[Union[str, "_models.WeekDays"]]] = rest_field( + name="weekDaysInMonth", visibility=["read", "create", "update", "delete", "query"] + ) + """Specific days of the week when the recurrence should repeat.""" + index: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Index of the week in a month at which the recurrence should repeat. For example, if the index + is '2', weekDay is 'Monday', interval is 3 and frequency is 'Month', the recurrence will run + every second Monday of the month and repeat every 3 months. Value of index can be 1 to 5. + Required.""" + interval: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The interval at which the recurrence should repeat. It signifies the number of months between + each recurrence. Required.""" + + @overload + def __init__( + self, + *, + index: int, + interval: int, + recurrence_end: Optional["_models.RecurrenceEnd"] = None, + week_days_in_month: Optional[List[Union[str, "_models.WeekDays"]]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, frequency=Frequency.MONTHLY_BY_DAYS, **kwargs) + + +class NameAndDescription(_Model): """The name and description. :ivar description: The description. @@ -780,7 +1039,121 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class OptionalLoadTestConfiguration(_model_base.Model): +class NotificationRule(_Model): + """Notification rule model. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + TestsNotificationRule + + :ivar notification_rule_id: The unique identifier of the notification rule. Required. + :vartype notification_rule_id: str + :ivar display_name: The name of the notification rule. Required. + :vartype display_name: str + :ivar action_group_ids: The action groups to notify. Required. + :vartype action_group_ids: list[str] + :ivar scope: The scope of the notification rule. Required. "Tests" + :vartype scope: str or ~azure.developer.loadtesting.models.NotificationScopeType + :ivar created_date_time: The creation datetime(RFC 3339 literal format). + :vartype created_date_time: ~datetime.datetime + :ivar created_by: The user that created. + :vartype created_by: str + :ivar last_modified_date_time: The last Modified datetime(RFC 3339 literal format). + :vartype last_modified_date_time: ~datetime.datetime + :ivar last_modified_by: The user that last modified. + :vartype last_modified_by: str + """ + + __mapping__: Dict[str, _Model] = {} + notification_rule_id: str = rest_field(name="notificationRuleId", visibility=["read"]) + """The unique identifier of the notification rule. Required.""" + display_name: str = rest_field(name="displayName", visibility=["read", "create", "update", "delete", "query"]) + """The name of the notification rule. Required.""" + action_group_ids: List[str] = rest_field( + name="actionGroupIds", visibility=["read", "create", "update", "delete", "query"] + ) + """The action groups to notify. Required.""" + scope: str = rest_discriminator(name="scope", visibility=["read", "create", "update", "delete", "query"]) + """The scope of the notification rule. Required. \"Tests\"""" + created_date_time: Optional[datetime.datetime] = rest_field( + name="createdDateTime", visibility=["read"], format="rfc3339" + ) + """The creation datetime(RFC 3339 literal format).""" + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read"]) + """The user that created.""" + last_modified_date_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedDateTime", visibility=["read"], format="rfc3339" + ) + """The last Modified datetime(RFC 3339 literal format).""" + last_modified_by: Optional[str] = rest_field(name="lastModifiedBy", visibility=["read"]) + """The user that last modified.""" + + @overload + def __init__( + self, + *, + display_name: str, + action_group_ids: List[str], + scope: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationStatus(_Model): + """Status of a long running operation. + + :ivar status: The state of the operation. Required. Known values are: "NotStarted", "Running", + "Succeeded", "Failed", and "Canceled". + :vartype status: str or ~azure.developer.loadtesting.models.OperationState + :ivar kind: The kind of the operation. Required. "CloneTest" + :vartype kind: str or ~azure.developer.loadtesting.models.OperationKind + :ivar error: Error object that describes the error when status is "Failed". + :vartype error: ~azure.core.ODataV4Format + :ivar id: The unique ID of the operation. Required. + :vartype id: str + """ + + status: Union[str, "_models.OperationState"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The state of the operation. Required. Known values are: \"NotStarted\", \"Running\", + \"Succeeded\", \"Failed\", and \"Canceled\".""" + kind: Union[str, "_models.OperationKind"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The kind of the operation. Required. \"CloneTest\"""" + error: Optional[ODataV4Format] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error object that describes the error when status is \"Failed\".""" + id: str = rest_field(visibility=["read"]) + """The unique ID of the operation. Required.""" + + @overload + def __init__( + self, + *, + status: Union[str, "_models.OperationState"], + kind: Union[str, "_models.OperationKind"], + error: Optional[ODataV4Format] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OptionalLoadTestConfiguration(_Model): """Configuration for quick load test. :ivar endpoint_url: Test URL. Provide the complete HTTP URL. For example, @@ -847,7 +1220,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class PassFailCriteria(_model_base.Model): +class PassFailCriteria(_Model): """Pass fail criteria for a test. :ivar pass_fail_metrics: Map of id and pass fail metrics { id : pass fail metrics }. @@ -886,13 +1259,14 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class PassFailMetric(_model_base.Model): +class PassFailMetric(_Model): """Pass fail metric. :ivar client_metric: The client metric on which the criteria should be applied. Known values are: "response_time_ms", "latency", "error", "requests", and "requests_per_sec". :vartype client_metric: str or ~azure.developer.loadtesting.models.PFMetrics :ivar aggregate: The aggregation function to be applied on the client metric. Allowed functions + * ‘percentage’ - for error metric , ‘avg’, percentiles like ‘p50’, ‘p90’, & so on, ‘min’, ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, ‘count’ - for requests. Known values are: "count", "percentage", "avg", "p50", "p75", "p90", @@ -924,6 +1298,7 @@ class PassFailMetric(_model_base.Model): visibility=["read", "create", "update", "delete", "query"] ) """The aggregation function to be applied on the client metric. Allowed functions + * ‘percentage’ - for error metric , ‘avg’, percentiles like ‘p50’, ‘p90’, & so on, ‘min’, ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, ‘count’ - for requests. Known values are: \"count\", \"percentage\", \"avg\", \"p50\", \"p75\", @@ -971,7 +1346,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class PassFailServerMetric(_model_base.Model): +class PassFailServerMetric(_Model): """Pass fail server metric. :ivar resource_id: The resource id of the resource emitting the metric. Required. @@ -1044,7 +1419,128 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class RegionalConfiguration(_model_base.Model): +class RecurrenceEnd(_Model): + """Recurrence end model. Either provide numberOfOccurrences if you want recurrence to end after a + specified number of occurrences or provide endDate if you want recurrence to end after a + specified end date. If both values are provided, a validation error will be thrown indicating + that only one field should be provided. If neither value is provided, the recurrence will end + when manually ended. + + :ivar number_of_occurrences: Number of occurrences after which the recurrence will end. + :vartype number_of_occurrences: int + :ivar end_date_time: The date after which the recurrence will end. (RFC 3339 literal format). + :vartype end_date_time: ~datetime.datetime + """ + + number_of_occurrences: Optional[int] = rest_field( + name="numberOfOccurrences", visibility=["read", "create", "update", "delete", "query"] + ) + """Number of occurrences after which the recurrence will end.""" + end_date_time: Optional[datetime.datetime] = rest_field( + name="endDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The date after which the recurrence will end. (RFC 3339 literal format).""" + + @overload + def __init__( + self, + *, + number_of_occurrences: Optional[int] = None, + end_date_time: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RecurrenceStatus(_Model): + """Actual state of the recurrence for the trigger. + + :ivar remaining_occurrences: The number of occurrences remaining for the trigger. Null if + recurrence end has end date instead of number of occurrences. + :vartype remaining_occurrences: int + :ivar next_scheduled_date_times: The next three execution times of the trigger. (RFC 3339 + literal format). + :vartype next_scheduled_date_times: list[~datetime.datetime] + """ + + remaining_occurrences: Optional[int] = rest_field( + name="remainingOccurrences", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of occurrences remaining for the trigger. Null if recurrence end has end date + instead of number of occurrences.""" + next_scheduled_date_times: Optional[List[datetime.datetime]] = rest_field( + name="nextScheduledDateTimes", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The next three execution times of the trigger. (RFC 3339 literal format).""" + + @overload + def __init__( + self, + *, + remaining_occurrences: Optional[int] = None, + next_scheduled_date_times: Optional[List[datetime.datetime]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RecurrenceWithCron(Recurrence, discriminator="Cron"): + """Recurrence is set based on cron expression. + + :ivar recurrence_end: Recurrence end model. You can specify the end either by providing a + numberOfOccurrences (which will end the recurrence after the specified number of occurrences) + or by providing an endDateTime (which will end the recurrence after the specified date). If + neither value is provided, the recurrence will continue until it is manually ended. However, if + both values are provided, an error will be thrown. + :vartype recurrence_end: ~azure.developer.loadtesting.models.RecurrenceEnd + :ivar frequency: Specify frequency using a cron expression. Required. Recurrence defined by a + cron expression. + :vartype frequency: str or ~azure.developer.loadtesting.models.CRON + :ivar cron_expression: Cron expression for the recurrence. Required. + :vartype cron_expression: str + """ + + frequency: Literal[Frequency.CRON] = rest_discriminator(name="frequency", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specify frequency using a cron expression. Required. Recurrence defined by a cron expression.""" + cron_expression: str = rest_field(name="cronExpression", visibility=["read", "create", "update", "delete", "query"]) + """Cron expression for the recurrence. Required.""" + + @overload + def __init__( + self, + *, + cron_expression: str, + recurrence_end: Optional["_models.RecurrenceEnd"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, frequency=Frequency.CRON, **kwargs) + + +class RegionalConfiguration(_Model): """Region distribution configuration for the load test. :ivar engine_instances: The number of engine instances to execute load test in specified @@ -1074,8 +1570,230 @@ class RegionalConfiguration(_model_base.Model): def __init__( self, *, - engine_instances: int, - region: str, + engine_instances: int, + region: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceMetric(_Model): + """Associated metric definition for particular metrics of the azure resource ( + Refer : + `https://learn.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition + `_). + + :ivar id: Unique name for metric. + :vartype id: str + :ivar resource_id: Azure resource id. Required. + :vartype resource_id: str + :ivar metric_namespace: Metric name space. Required. + :vartype metric_namespace: str + :ivar display_description: Metric description. + :vartype display_description: str + :ivar name: The invariant value of metric name. Required. + :vartype name: str + :ivar aggregation: Metric aggregation. Required. + :vartype aggregation: str + :ivar unit: Metric unit. + :vartype unit: str + :ivar resource_type: Azure resource type. Required. + :vartype resource_type: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Unique name for metric.""" + resource_id: str = rest_field(name="resourceId", visibility=["read", "create", "update", "delete", "query"]) + """Azure resource id. Required.""" + metric_namespace: str = rest_field( + name="metricNamespace", visibility=["read", "create", "update", "delete", "query"] + ) + """Metric name space. Required.""" + display_description: Optional[str] = rest_field( + name="displayDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """Metric description.""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The invariant value of metric name. Required.""" + aggregation: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Metric aggregation. Required.""" + unit: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Metric unit.""" + resource_type: str = rest_field(name="resourceType", visibility=["read", "create", "update", "delete", "query"]) + """Azure resource type. Required.""" + + @overload + def __init__( + self, + *, + resource_id: str, + metric_namespace: str, + name: str, + aggregation: str, + resource_type: str, + display_description: Optional[str] = None, + unit: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Trigger(_Model): + """Trigger model. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ScheduleTestsTrigger + + :ivar trigger_id: The unique identifier of the trigger. Required. + :vartype trigger_id: str + :ivar display_name: The name of the trigger. Required. + :vartype display_name: str + :ivar description: The description of the trigger. + :vartype description: str + :ivar kind: The type of the trigger. Required. "ScheduleTestsTrigger" + :vartype kind: str or ~azure.developer.loadtesting.models.TriggerType + :ivar state: The current state of the trigger. Known values are: "Active", "Paused", + "Completed", and "Disabled". + :vartype state: str or ~azure.developer.loadtesting.models.TriggerState + :ivar state_details: Details of current state of the trigger. + :vartype state_details: ~azure.developer.loadtesting.models.StateDetails + :ivar created_date_time: The creation datetime(RFC 3339 literal format). + :vartype created_date_time: ~datetime.datetime + :ivar created_by: The user that created. + :vartype created_by: str + :ivar last_modified_date_time: The last Modified datetime(RFC 3339 literal format). + :vartype last_modified_date_time: ~datetime.datetime + :ivar last_modified_by: The user that last modified. + :vartype last_modified_by: str + """ + + __mapping__: Dict[str, _Model] = {} + trigger_id: str = rest_field(name="triggerId", visibility=["read"]) + """The unique identifier of the trigger. Required.""" + display_name: str = rest_field(name="displayName", visibility=["read", "create", "update", "delete", "query"]) + """The name of the trigger. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of the trigger.""" + kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) + """The type of the trigger. Required. \"ScheduleTestsTrigger\"""" + state: Optional[Union[str, "_models.TriggerState"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The current state of the trigger. Known values are: \"Active\", \"Paused\", \"Completed\", and + \"Disabled\".""" + state_details: Optional["_models.StateDetails"] = rest_field(name="stateDetails", visibility=["read"]) + """Details of current state of the trigger.""" + created_date_time: Optional[datetime.datetime] = rest_field( + name="createdDateTime", visibility=["read"], format="rfc3339" + ) + """The creation datetime(RFC 3339 literal format).""" + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read"]) + """The user that created.""" + last_modified_date_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedDateTime", visibility=["read"], format="rfc3339" + ) + """The last Modified datetime(RFC 3339 literal format).""" + last_modified_by: Optional[str] = rest_field(name="lastModifiedBy", visibility=["read"]) + """The user that last modified.""" + + @overload + def __init__( + self, + *, + display_name: str, + kind: str, + description: Optional[str] = None, + state: Optional[Union[str, "_models.TriggerState"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScheduleTestsTrigger(Trigger, discriminator="ScheduleTestsTrigger"): + """ScheduleTestsTrigger model. + + :ivar trigger_id: The unique identifier of the trigger. Required. + :vartype trigger_id: str + :ivar display_name: The name of the trigger. Required. + :vartype display_name: str + :ivar description: The description of the trigger. + :vartype description: str + :ivar state: The current state of the trigger. Known values are: "Active", "Paused", + "Completed", and "Disabled". + :vartype state: str or ~azure.developer.loadtesting.models.TriggerState + :ivar state_details: Details of current state of the trigger. + :vartype state_details: ~azure.developer.loadtesting.models.StateDetails + :ivar created_date_time: The creation datetime(RFC 3339 literal format). + :vartype created_date_time: ~datetime.datetime + :ivar created_by: The user that created. + :vartype created_by: str + :ivar last_modified_date_time: The last Modified datetime(RFC 3339 literal format). + :vartype last_modified_date_time: ~datetime.datetime + :ivar last_modified_by: The user that last modified. + :vartype last_modified_by: str + :ivar kind: The type of the trigger is ScheduleTestsTrigger. Required. Trigger is a Scheduled + Trigger on a Test. + :vartype kind: str or ~azure.developer.loadtesting.models.SCHEDULE_TESTS_TRIGGER + :ivar test_ids: The test id of test to be triggered by this schedule trigger. Currently only + one test is supported for a trigger. Required. + :vartype test_ids: list[str] + :ivar start_date_time: Start date time of the trigger in UTC timezone. (RFC 3339 literal + format). + :vartype start_date_time: ~datetime.datetime + :ivar recurrence_status: + :vartype recurrence_status: ~azure.developer.loadtesting.models.RecurrenceStatus + :ivar recurrence: Recurrence details of the trigger. Null if schedule is not recurring. + :vartype recurrence: ~azure.developer.loadtesting.models.Recurrence + """ + + kind: Literal[TriggerType.SCHEDULE_TESTS_TRIGGER] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of the trigger is ScheduleTestsTrigger. Required. Trigger is a Scheduled Trigger on a + Test.""" + test_ids: List[str] = rest_field(name="testIds", visibility=["read", "create", "update", "delete", "query"]) + """The test id of test to be triggered by this schedule trigger. Currently only one test is + supported for a trigger. Required.""" + start_date_time: Optional[datetime.datetime] = rest_field( + name="startDateTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Start date time of the trigger in UTC timezone. (RFC 3339 literal format).""" + recurrence_status: Optional["_models.RecurrenceStatus"] = rest_field(name="recurrenceStatus", visibility=["read"]) + recurrence: Optional["_models.Recurrence"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Recurrence details of the trigger. Null if schedule is not recurring.""" + + @overload + def __init__( + self, + *, + display_name: str, + test_ids: List[str], + description: Optional[str] = None, + state: Optional[Union[str, "_models.TriggerState"]] = None, + start_date_time: Optional[datetime.datetime] = None, + recurrence: Optional["_models.Recurrence"] = None, ) -> None: ... @overload @@ -1086,65 +1804,31 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: - super().__init__(*args, **kwargs) + super().__init__(*args, kind=TriggerType.SCHEDULE_TESTS_TRIGGER, **kwargs) -class ResourceMetric(_model_base.Model): - """Associated metric definition for particular metrics of the azure resource ( - Refer : - `https://learn.microsoft.com/en-us/rest/api/monitor/metric-definitions/list#metricdefinition - `_). +class Secret(_Model): + """Secret. - :ivar id: Unique name for metric. - :vartype id: str - :ivar resource_id: Azure resource id. Required. - :vartype resource_id: str - :ivar metric_namespace: Metric name space. Required. - :vartype metric_namespace: str - :ivar display_description: Metric description. - :vartype display_description: str - :ivar name: The invariant value of metric name. Required. - :vartype name: str - :ivar aggregation: Metric aggregation. Required. - :vartype aggregation: str - :ivar unit: Metric unit. - :vartype unit: str - :ivar resource_type: Azure resource type. Required. - :vartype resource_type: str + :ivar value: The value of the secret for the respective type. + :vartype value: str + :ivar type: Type of secret. Known values are: "AKV_SECRET_URI" and "SECRET_VALUE". + :vartype type: str or ~azure.developer.loadtesting.models.SecretType """ - id: Optional[str] = rest_field(visibility=["read"]) - """Unique name for metric.""" - resource_id: str = rest_field(name="resourceId", visibility=["read", "create", "update", "delete", "query"]) - """Azure resource id. Required.""" - metric_namespace: str = rest_field( - name="metricNamespace", visibility=["read", "create", "update", "delete", "query"] - ) - """Metric name space. Required.""" - display_description: Optional[str] = rest_field( - name="displayDescription", visibility=["read", "create", "update", "delete", "query"] + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The value of the secret for the respective type.""" + type: Optional[Union[str, "_models.SecretType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] ) - """Metric description.""" - name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The invariant value of metric name. Required.""" - aggregation: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Metric aggregation. Required.""" - unit: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """Metric unit.""" - resource_type: str = rest_field(name="resourceType", visibility=["read", "create", "update", "delete", "query"]) - """Azure resource type. Required.""" + """Type of secret. Known values are: \"AKV_SECRET_URI\" and \"SECRET_VALUE\".""" @overload def __init__( self, *, - resource_id: str, - metric_namespace: str, - name: str, - aggregation: str, - resource_type: str, - display_description: Optional[str] = None, - unit: Optional[str] = None, + value: Optional[str] = None, + type: Optional[Union[str, "_models.SecretType"]] = None, ) -> None: ... @overload @@ -1158,28 +1842,21 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Secret(_model_base.Model): - """Secret. +class StateDetails(_Model): + """State details of the trigger. - :ivar value: The value of the secret for the respective type. - :vartype value: str - :ivar type: Type of secret. Known values are: "AKV_SECRET_URI" and "SECRET_VALUE". - :vartype type: str or ~azure.developer.loadtesting.models.SecretType + :ivar message: The error message if the trigger is in disabled state. + :vartype message: str """ - value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) - """The value of the secret for the respective type.""" - type: Optional[Union[str, "_models.SecretType"]] = rest_field( - visibility=["read", "create", "update", "delete", "query"] - ) - """Type of secret. Known values are: \"AKV_SECRET_URI\" and \"SECRET_VALUE\".""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error message if the trigger is in disabled state.""" @overload def __init__( self, *, - value: Optional[str] = None, - type: Optional[Union[str, "_models.SecretType"]] = None, + message: Optional[str] = None, ) -> None: ... @overload @@ -1193,7 +1870,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class Test(_model_base.Model): +class Test(_Model): """Load test model. :ivar pass_fail_criteria: Pass fail criteria for a test. @@ -1392,7 +2069,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TestAppComponents(_model_base.Model): +class TestAppComponents(_Model): """Test app components. :ivar components: Azure resource collection { resource id (fully qualified resource Id e.g @@ -1450,7 +2127,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TestFileInfo(_model_base.Model): +class TestFileInfo(_Model): """Test file info. :ivar file_name: Name of the file. Required. @@ -1507,7 +2184,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TestInputArtifacts(_model_base.Model): +class TestInputArtifacts(_Model): """The input artifacts for the test. :ivar config_file_info: The load test YAML file that contains the the test configuration. @@ -1571,7 +2248,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TestProfile(_model_base.Model): +class TestProfile(_Model): """Test Profile Model. :ivar test_profile_id: Unique identifier for the test profile, must contain only lower-case @@ -1655,7 +2332,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TestProfileRun(_model_base.Model): +class TestProfileRun(_Model): """Test Profile Run model. :ivar test_profile_run_id: Unique identifier for the test profile run, must contain only @@ -1774,7 +2451,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TestProfileRunRecommendation(_model_base.Model): +class TestProfileRunRecommendation(_Model): """A recommendation object that provides a list of configuration that optimizes its category. :ivar category: Category of the recommendation. Required. Known values are: @@ -1813,7 +2490,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TestRun(_model_base.Model): +class TestRun(_Model): """Load test run model. :ivar test_run_id: Unique test run identifier for the load test run, must contain only @@ -1895,8 +2572,11 @@ class TestRun(_model_base.Model): access. :vartype public_ip_disabled: bool :ivar created_by_type: The type of the entity that created the test run. (E.x. User, - ScheduleTrigger, etc). Known values are: "User" and "ScheduledTrigger". + ScheduleTrigger, etc). Known values are: "User", "ScheduledTrigger", "AzurePipelines", and + "GitHubWorkflows". :vartype created_by_type: str or ~azure.developer.loadtesting.models.CreatedByType + :ivar created_by_uri: The URI pointing to the entity that created the test run. + :vartype created_by_uri: str :ivar created_date_time: The creation datetime(RFC 3339 literal format). :vartype created_date_time: ~datetime.datetime :ivar created_by: The user that created. @@ -2011,7 +2691,9 @@ class TestRun(_model_base.Model): name="createdByType", visibility=["read", "create", "update", "delete", "query"] ) """The type of the entity that created the test run. (E.x. User, ScheduleTrigger, etc). Known - values are: \"User\" and \"ScheduledTrigger\".""" + values are: \"User\", \"ScheduledTrigger\", \"AzurePipelines\", and \"GitHubWorkflows\".""" + created_by_uri: Optional[str] = rest_field(name="createdByUri", visibility=["read"]) + """The URI pointing to the entity that created the test run.""" created_date_time: Optional[datetime.datetime] = rest_field( name="createdDateTime", visibility=["read"], format="rfc3339" ) @@ -2053,7 +2735,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TestRunAppComponents(_model_base.Model): +class TestRunAppComponents(_Model): """Test run app component. :ivar components: Azure resource collection { resource id (fully qualified resource Id e.g @@ -2111,7 +2793,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TestRunArtifacts(_model_base.Model): +class TestRunArtifacts(_Model): """Collection of test run artifacts. :ivar input_artifacts: The input artifacts for the test run. @@ -2145,7 +2827,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TestRunDetail(_model_base.Model): +class TestRunDetail(_Model): """Details of a particular test run for a test profile run. :ivar status: Status of the test run. Required. Known values are: "ACCEPTED", "NOTSTARTED", @@ -2191,7 +2873,115 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TestRunFileInfo(_model_base.Model): +class TestRunEndedEventCondition(_Model): + """TestRunEnded Event condition. + + :ivar test_run_statuses: The test run statuses to send notification for. + :vartype test_run_statuses: list[str or ~azure.developer.loadtesting.models.TestRunStatus] + :ivar test_run_results: The test run results to send notification for. + :vartype test_run_results: list[str or ~azure.developer.loadtesting.models.PassFailTestResult] + """ + + test_run_statuses: Optional[List[Union[str, "_models.TestRunStatus"]]] = rest_field( + name="testRunStatuses", visibility=["read", "create", "update", "delete", "query"] + ) + """The test run statuses to send notification for.""" + test_run_results: Optional[List[Union[str, "_models.PassFailTestResult"]]] = rest_field( + name="testRunResults", visibility=["read", "create", "update", "delete", "query"] + ) + """The test run results to send notification for.""" + + @overload + def __init__( + self, + *, + test_run_statuses: Optional[List[Union[str, "_models.TestRunStatus"]]] = None, + test_run_results: Optional[List[Union[str, "_models.PassFailTestResult"]]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TestsNotificationEventFilter(_Model): + """The notification event filter for Tests scope. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + TestRunEndedNotificationEventFilter, TestRunStartedNotificationEventFilter, + TriggerCompletedNotificationEventFilter, TriggerDisabledNotificationEventFilter + + :ivar kind: The event type. Required. Known values are: "TestRunEnded", "TestRunStarted", + "TriggerCompleted", and "TriggerDisabled". + :vartype kind: str or ~azure.developer.loadtesting.models.NotificationEventType + """ + + __mapping__: Dict[str, _Model] = {} + kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) + """The event type. Required. Known values are: \"TestRunEnded\", \"TestRunStarted\", + \"TriggerCompleted\", and \"TriggerDisabled\".""" + + @overload + def __init__( + self, + *, + kind: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TestRunEndedNotificationEventFilter(TestsNotificationEventFilter, discriminator="TestRunEnded"): + """The notification event filter when the event type is TestRunEnded and scope is Tests. + + :ivar kind: Event type for test run ended event. Required. Test run ended event. This event + would occur when a test run reaches terminal state. + :vartype kind: str or ~azure.developer.loadtesting.models.TEST_RUN_ENDED + :ivar condition: Event filtering condition. + :vartype condition: ~azure.developer.loadtesting.models.TestRunEndedEventCondition + """ + + kind: Literal[NotificationEventType.TEST_RUN_ENDED] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Event type for test run ended event. Required. Test run ended event. This event would occur + when a test run reaches terminal state.""" + condition: Optional["_models.TestRunEndedEventCondition"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Event filtering condition.""" + + @overload + def __init__( + self, + *, + condition: Optional["_models.TestRunEndedEventCondition"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, kind=NotificationEventType.TEST_RUN_ENDED, **kwargs) + + +class TestRunFileInfo(_Model): """Test run file info. :ivar file_name: Name of the file. Required. @@ -2248,7 +3038,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TestRunInputArtifacts(_model_base.Model): +class TestRunInputArtifacts(_Model): """The input artifacts for the test run. :ivar config_file_info: The load test YAML file that contains the the test configuration. @@ -2312,7 +3102,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TestRunOutputArtifacts(_model_base.Model): +class TestRunOutputArtifacts(_Model): """The output artifacts for the test run. :ivar result_file_info: The test run results file. @@ -2363,7 +3153,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TestRunServerMetricsConfiguration(_model_base.Model): +class TestRunServerMetricsConfiguration(_Model): """Test run server metrics configuration. :ivar test_run_id: Test run identifier. @@ -2423,7 +3213,35 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TestRunStatistics(_model_base.Model): +class TestRunStartedNotificationEventFilter(TestsNotificationEventFilter, discriminator="TestRunStarted"): + """The notification event filter when the event type is TestRunStarted and scope is Tests. + + :ivar kind: Event type for test run started event. Required. Test run started event. This event + would occur when a new test run is triggered. + :vartype kind: str or ~azure.developer.loadtesting.models.TEST_RUN_STARTED + """ + + kind: Literal[NotificationEventType.TEST_RUN_STARTED] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Event type for test run started event. Required. Test run started event. This event would occur + when a new test run is triggered.""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, kind=NotificationEventType.TEST_RUN_STARTED, **kwargs) + + +class TestRunStatistics(_Model): """Test run statistics. :ivar transaction: Transaction name. @@ -2510,7 +3328,7 @@ class TestRunStatistics(_model_base.Model): """Send network bytes.""" -class TestServerMetricsConfiguration(_model_base.Model): +class TestServerMetricsConfiguration(_Model): """Test server metrics configuration. :ivar test_id: Test identifier. @@ -2570,7 +3388,68 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) -class TimeSeriesElement(_model_base.Model): +class TestsNotificationRule(NotificationRule, discriminator="Tests"): + """Tests Notification rule model. + + :ivar notification_rule_id: The unique identifier of the notification rule. Required. + :vartype notification_rule_id: str + :ivar display_name: The name of the notification rule. Required. + :vartype display_name: str + :ivar action_group_ids: The action groups to notify. Required. + :vartype action_group_ids: list[str] + :ivar created_date_time: The creation datetime(RFC 3339 literal format). + :vartype created_date_time: ~datetime.datetime + :ivar created_by: The user that created. + :vartype created_by: str + :ivar last_modified_date_time: The last Modified datetime(RFC 3339 literal format). + :vartype last_modified_date_time: ~datetime.datetime + :ivar last_modified_by: The user that last modified. + :vartype last_modified_by: str + :ivar scope: Scope of type Tests. Required. Notification rule is for Tests. + :vartype scope: str or ~azure.developer.loadtesting.models.TESTS + :ivar test_ids: The test ids to include. If not provided, notification will be sent for all + testIds. + :vartype test_ids: list[str] + :ivar event_filters: The event to receive notifications for along with filtering conditions. + Key is a user-assigned identifier for the event filter. Required. + :vartype event_filters: dict[str, + ~azure.developer.loadtesting.models.TestsNotificationEventFilter] + """ + + scope: Literal[NotificationScopeType.TESTS] = rest_discriminator(name="scope", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Scope of type Tests. Required. Notification rule is for Tests.""" + test_ids: Optional[List[str]] = rest_field( + name="testIds", visibility=["read", "create", "update", "delete", "query"] + ) + """The test ids to include. If not provided, notification will be sent for all testIds.""" + event_filters: Dict[str, "_models.TestsNotificationEventFilter"] = rest_field( + name="eventFilters", visibility=["read", "create", "update", "delete", "query"] + ) + """The event to receive notifications for along with filtering conditions. + Key is a user-assigned identifier for the event filter. Required.""" + + @overload + def __init__( + self, + *, + display_name: str, + action_group_ids: List[str], + event_filters: Dict[str, "_models.TestsNotificationEventFilter"], + test_ids: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, scope=NotificationScopeType.TESTS, **kwargs) + + +class TimeSeriesElement(_Model): """The time series returned when a data query is performed. :ivar data: An array of data points representing the metric values. @@ -2603,3 +3482,109 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) + + +class TriggerCompletedNotificationEventFilter(TestsNotificationEventFilter, discriminator="TriggerCompleted"): + """The notification event filter when the event type is TriggerCompleted. + + :ivar kind: Event type for trigger ended event. Required. Trigger completed event. This event + would occur when a trigger completes. + :vartype kind: str or ~azure.developer.loadtesting.models.TRIGGER_COMPLETED + """ + + kind: Literal[NotificationEventType.TRIGGER_COMPLETED] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Event type for trigger ended event. Required. Trigger completed event. This event would occur + when a trigger completes.""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, kind=NotificationEventType.TRIGGER_COMPLETED, **kwargs) + + +class TriggerDisabledNotificationEventFilter(TestsNotificationEventFilter, discriminator="TriggerDisabled"): + """The notification event filter when the event type is TriggerDisabled. + + :ivar kind: Event type for trigger disabled event. Required. Trigger disabled event. This event + would occur when a trigger is disabled. + :vartype kind: str or ~azure.developer.loadtesting.models.TRIGGER_DISABLED + """ + + kind: Literal[NotificationEventType.TRIGGER_DISABLED] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Event type for trigger disabled event. Required. Trigger disabled event. This event would occur + when a trigger is disabled.""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, kind=NotificationEventType.TRIGGER_DISABLED, **kwargs) + + +class WeeklyRecurrence(Recurrence, discriminator="Weekly"): + """Recurrence model when frequency is set as weekly. + + :ivar recurrence_end: Recurrence end model. You can specify the end either by providing a + numberOfOccurrences (which will end the recurrence after the specified number of occurrences) + or by providing an endDateTime (which will end the recurrence after the specified date). If + neither value is provided, the recurrence will continue until it is manually ended. However, if + both values are provided, an error will be thrown. + :vartype recurrence_end: ~azure.developer.loadtesting.models.RecurrenceEnd + :ivar frequency: Frequency of the week recurrence. Required. Recurrence defined on a weekly + basis, as specified by WeeklyRecurrence. + :vartype frequency: str or ~azure.developer.loadtesting.models.WEEKLY + :ivar days_of_week: Recurrence set to repeat on the specified days of the week. + :vartype days_of_week: list[str or ~azure.developer.loadtesting.models.WeekDays] + :ivar interval: The interval at which the recurrence should repeat. It signifies the number of + weeks between each recurrence. + :vartype interval: int + """ + + frequency: Literal[Frequency.WEEKLY] = rest_discriminator(name="frequency", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Frequency of the week recurrence. Required. Recurrence defined on a weekly basis, as specified + by WeeklyRecurrence.""" + days_of_week: Optional[List[Union[str, "_models.WeekDays"]]] = rest_field( + name="daysOfWeek", visibility=["read", "create", "update", "delete", "query"] + ) + """Recurrence set to repeat on the specified days of the week.""" + interval: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The interval at which the recurrence should repeat. It signifies the number of weeks between + each recurrence.""" + + @overload + def __init__( + self, + *, + recurrence_end: Optional["_models.RecurrenceEnd"] = None, + days_of_week: Optional[List[Union[str, "_models.WeekDays"]]] = None, + interval: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, frequency=Frequency.WEEKLY, **kwargs) diff --git a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/models/_patch.py b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/models/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/models/_patch.py +++ b/sdk/loadtesting/azure-developer-loadtesting/azure/developer/loadtesting/models/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_notification_rule.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_notification_rule.py new file mode 100644 index 000000000000..0dd97f123ce2 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_notification_rule.py @@ -0,0 +1,59 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python create_or_update_notification_rule.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.create_or_update_notification_rule( + notification_rule_id="12345678-1234-1234-1234-123456789012", + body={ + "actionGroupIds": [ + "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/sampleRG/providers/microsoft.insights/actionGroups/sampleActionGroup" + ], + "displayName": "Sample_Notification_Rule", + "eventFilters": { + "eventfilter1": { + "condition": {"testRunResults": ["PASSED", "FAILED"], "testRunStatuses": ["FAILED", "DONE"]}, + "kind": "TestRunEnded", + }, + "eventfilter2": {"kind": "TestRunStarted"}, + "eventfilter3": {"kind": "TriggerCompleted"}, + "eventfilter4": {"kind": "TriggerDisabled"}, + }, + "scope": "Tests", + "testIds": ["12345678-1234-1234-1234-123456789012"], + }, + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/CreateOrUpdateNotificationRule.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test.py new file mode 100644 index 000000000000..c1314a811816 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test.py @@ -0,0 +1,99 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python create_or_update_test.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.create_or_update_test( + test_id="12345678-1234-1234-1234-123456789012", + body={ + "autoStopCriteria": { + "autoStopDisabled": True, + "errorRate": 70, + "errorRateTimeWindowInSeconds": 60, + "maximumVirtualUsersPerEngine": 5000, + }, + "description": "sample description", + "displayName": "Performance_LoadTest", + "engineBuiltInIdentityIds": [ + "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/samplerg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sampleresourcename" + ], + "engineBuiltInIdentityType": "UserAssigned", + "environmentVariables": {"envvar1": "sampletext"}, + "keyvaultReferenceIdentityId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/sampleprovider/sampleresourcetype/sampleresourcename", + "keyvaultReferenceIdentityType": "UserAssigned", + "kind": "JMX", + "loadTestConfiguration": { + "engineInstances": 6, + "regionalLoadTestConfig": [ + {"engineInstances": 4, "region": "northeurope"}, + {"engineInstances": 2, "region": "westeurope"}, + ], + "splitAllCSVs": True, + }, + "metricsReferenceIdentityId": "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/samplerg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sampleresourcename", + "metricsReferenceIdentityType": "UserAssigned", + "passFailCriteria": { + "passFailMetrics": { + "fefd759d-7fe8-4f83-8b6d-aeebe0f491fe": { + "action": "continue", + "aggregate": "percentage", + "clientMetric": "response_time_ms", + "condition": ">", + "value": 20, + } + }, + "passFailServerMetrics": { + "fefd759d-7fe8-4f83-8b6d-aeebe0f491fe": { + "action": "continue", + "aggregation": "Average", + "condition": ">", + "metricName": "Percentage CPU", + "metricNamespace": "Microsoft.Compute/virtualMachines", + "resourceId": "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines/MyVM", + "value": 20, + } + }, + }, + "secrets": { + "secret1": { + "type": "AKV_SECRET_URI", + "value": "https://samplevault.vault.azure.net/secrets/samplesecret/f113f91fd4c44a368049849c164db827", + } + }, + "subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Network/virtualNetworks/samplenetworkresource/subnets/AAAAA0A0A0", + }, + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/CreateOrUpdateTest.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_app_components.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_app_components.py new file mode 100644 index 000000000000..df8964e0e655 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_app_components.py @@ -0,0 +1,52 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python create_or_update_test_app_components.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.create_or_update_app_components( + test_id="ee843bd9-a6d4-4364-a45c-427a03c39fa7", + body={ + "components": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource": { + "displayName": "Performance_LoadTest_Insights", + "kind": "web", + "resourceName": "appcomponentresource", + "resourceType": "microsoft.insights/components", + } + } + }, + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/CreateOrUpdateTestAppComponents.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_locust.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_locust.py new file mode 100644 index 000000000000..f0684b00b9b7 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_locust.py @@ -0,0 +1,99 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python create_or_update_test_locust.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.create_or_update_test( + test_id="12345678-1234-1234-1234-123456789012", + body={ + "autoStopCriteria": { + "autoStopDisabled": True, + "errorRate": 70, + "errorRateTimeWindowInSeconds": 60, + "maximumVirtualUsersPerEngine": 5000, + }, + "description": "sample description", + "displayName": "Performance_LoadTest", + "engineBuiltInIdentityIds": [ + "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/samplerg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sampleresourcename" + ], + "engineBuiltInIdentityType": "UserAssigned", + "environmentVariables": {"envvar1": "sampletext"}, + "keyvaultReferenceIdentityId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/sampleprovider/sampleresourcetype/sampleresourcename", + "keyvaultReferenceIdentityType": "UserAssigned", + "kind": "Locust", + "loadTestConfiguration": { + "engineInstances": 6, + "regionalLoadTestConfig": [ + {"engineInstances": 4, "region": "northeurope"}, + {"engineInstances": 2, "region": "westeurope"}, + ], + "splitAllCSVs": False, + }, + "metricsReferenceIdentityId": "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/samplerg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sampleresourcename", + "metricsReferenceIdentityType": "UserAssigned", + "passFailCriteria": { + "passFailMetrics": { + "fefd759d-7fe8-4f83-8b6d-aeebe0f491fe": { + "action": "continue", + "aggregate": "percentage", + "clientMetric": "response_time_ms", + "condition": ">", + "value": 20, + } + }, + "passFailServerMetrics": { + "fefd759d-7fe8-4f83-8b6d-aeebe0f491fe": { + "action": "continue", + "aggregation": "Average", + "condition": ">", + "metricName": "Percentage CPU", + "metricNamespace": "Microsoft.Compute/virtualMachines", + "resourceId": "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines/MyVM", + "value": 20, + } + }, + }, + "secrets": { + "secret1": { + "type": "AKV_SECRET_URI", + "value": "https://samplevault.vault.azure.net/secrets/samplesecret/f113f91fd4c44a368049849c164db827", + } + }, + "subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Network/virtualNetworks/samplenetworkresource/subnets/AAAAA0A0A0", + }, + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/CreateOrUpdateTest_Locust.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_profile.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_profile.py new file mode 100644 index 000000000000..a06e2bedf56f --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_profile.py @@ -0,0 +1,55 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python create_or_update_test_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.create_or_update_test_profile( + test_profile_id="12345678-1234-1234-1234-123456789012", + body={ + "description": "sample description", + "displayName": "Performance_TestProfile", + "targetResourceConfigurations": { + "configurations": { + "config1": {"httpConcurrency": 16, "instanceMemoryMB": 2048}, + "config2": {"httpConcurrency": 16, "instanceMemoryMB": 4096}, + }, + "kind": "FunctionsFlexConsumption", + }, + "targetResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Web/sites/myfunctionapp", + "testId": "12346-abcd-6789", + }, + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/CreateOrUpdateTestProfile.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_run_app_components.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_run_app_components.py new file mode 100644 index 000000000000..a7a7e08346e1 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_run_app_components.py @@ -0,0 +1,52 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python create_or_update_test_run_app_components.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.create_or_update_app_components( + test_run_id="ee843bd9-a6d4-4364-a45c-427a03c39fa7", + body={ + "components": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource": { + "displayName": "Performance_LoadTest_Insights", + "kind": "web", + "resourceName": "appcomponentresource", + "resourceType": "microsoft.insights/components", + } + } + }, + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/CreateOrUpdateTestRunAppComponents.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_run_server_metrics_config.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_run_server_metrics_config.py new file mode 100644 index 000000000000..26f8b2897737 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_run_server_metrics_config.py @@ -0,0 +1,55 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python create_or_update_test_run_server_metrics_config.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.create_or_update_server_metrics_config( + test_run_id="edc6e529-d009-4b99-b763-ca492e3a2823", + body={ + "metrics": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration": { + "aggregation": "Average", + "displayDescription": "sample description", + "metricNamespace": "microsoft.insights/components", + "name": "requests/duration", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource", + "resourceType": "microsoft.insights/components", + "unit": None, + } + } + }, + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/CreateOrUpdateTestRunServerMetricsConfig.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_server_metrics_config.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_server_metrics_config.py new file mode 100644 index 000000000000..e2161c661ece --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_test_server_metrics_config.py @@ -0,0 +1,55 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python create_or_update_test_server_metrics_config.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.create_or_update_server_metrics_config( + test_id="edc6e529-d009-4b99-b763-ca492e3a2823", + body={ + "metrics": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration": { + "aggregation": "Average", + "displayDescription": "sample description", + "metricNamespace": "microsoft.insights/components", + "name": "requests/duration", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource", + "resourceType": "microsoft.insights/components", + "unit": None, + } + } + }, + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/CreateOrUpdateTestServerMetricsConfig.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_trigger.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_trigger.py new file mode 100644 index 000000000000..27e420db2c92 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/create_or_update_trigger.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python create_or_update_trigger.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.create_or_update_trigger( + trigger_id="12345678-1234-1234-1234-123456789012", + body={ + "description": "sample description", + "displayName": "Sample_Trigger", + "kind": "ScheduleTestsTrigger", + "recurrence": {"frequency": "Daily", "interval": 1, "recurrenceEnd": {"numberOfOccurrences": 10}}, + "startDateTime": "2024-05-01T00:00:00Z", + "state": "Active", + "testIds": ["12345678-1234-1234-1234-123456789012"], + }, + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/CreateOrUpdateTrigger.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_notification_rule.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_notification_rule.py new file mode 100644 index 000000000000..997feeb69b8f --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_notification_rule.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python delete_notification_rule.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.delete_notification_rule( + notification_rule_id="12345678-1234-1234-1234-123456789012", + ) + + +# x-ms-original-file: 2025-03-01-preview/DeleteNotificationRule.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_test.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_test.py new file mode 100644 index 000000000000..94cdddb50c47 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_test.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python delete_test.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.delete_test( + test_id="12345678-1234-1234-1234-123456789012", + ) + + +# x-ms-original-file: 2025-03-01-preview/DeleteTest.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_test_file.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_test_file.py new file mode 100644 index 000000000000..c58fcceb7aae --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_test_file.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python delete_test_file.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.delete_test_file( + test_id="12345678-1234-1234-1234-123456789012", + file_name="app.jmx", + ) + + +# x-ms-original-file: 2025-03-01-preview/DeleteTestFile.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_test_profile.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_test_profile.py new file mode 100644 index 000000000000..dd55deca9cfe --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_test_profile.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python delete_test_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.delete_test_profile( + test_profile_id="12345678-1234-1234-1234-123456789012", + ) + + +# x-ms-original-file: 2025-03-01-preview/DeleteTestProfile.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_test_profile_run.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_test_profile_run.py new file mode 100644 index 000000000000..259f2eca9020 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_test_profile_run.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python delete_test_profile_run.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.delete_test_profile_run( + test_profile_run_id="12316678-1234-1234-1234-122451189012", + ) + + +# x-ms-original-file: 2025-03-01-preview/DeleteTestProfileRun.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_test_run.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_test_run.py new file mode 100644 index 000000000000..b7f3dbe6dd79 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_test_run.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python delete_test_run.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.delete_test_run( + test_run_id="12316678-1234-1234-1234-122451189012", + ) + + +# x-ms-original-file: 2025-03-01-preview/DeleteTestRun.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_trigger.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_trigger.py new file mode 100644 index 000000000000..112722170e58 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/delete_trigger.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python delete_trigger.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + client.delete_trigger( + trigger_id="12345678-1234-1234-1234-123456789012", + ) + + +# x-ms-original-file: 2025-03-01-preview/DeleteTrigger.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_notification_rule.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_notification_rule.py new file mode 100644 index 000000000000..2ced004b7f55 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_notification_rule.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python get_notification_rule.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.get_notification_rule( + notification_rule_id="12345678-1234-1234-1234-123456789012", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/GetNotificationRule.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_status.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_status.py new file mode 100644 index 000000000000..5911cf2639d3 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_status.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python get_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.get_operation_status( + operation_id="12345678-1234-1234-1234-123456789012", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/GetStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test.py new file mode 100644 index 000000000000..4ded50e0739a --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python get_test.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.get_test( + test_id="12345678-1234-1234-1234-123456789012", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/GetTest.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_file.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_file.py new file mode 100644 index 000000000000..7eb6fcb186b9 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_file.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python get_test_file.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.get_test_file( + test_id="12345678-1234-1234-1234-123456789012", + file_name="sample.jmx", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/GetTestFile.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_profile.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_profile.py new file mode 100644 index 000000000000..6ac1cd41c80e --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_profile.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python get_test_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.get_test_profile( + test_profile_id="12345678-1234-1234-1234-123456789012", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/GetTestProfile.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_profile_run_executed.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_profile_run_executed.py new file mode 100644 index 000000000000..06a794d1d4fb --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_profile_run_executed.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python get_test_profile_run_executed.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.get_test_profile_run( + test_profile_run_id="12316678-1234-1234-1234-122451189012", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/GetTestProfileRun_Executed.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_profile_run_executing.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_profile_run_executing.py new file mode 100644 index 000000000000..06478cfbeced --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_profile_run_executing.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python get_test_profile_run_executing.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.get_test_profile_run( + test_profile_run_id="12316678-1234-1234-1234-122451189012", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/GetTestProfileRun_Executing.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_run.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_run.py new file mode 100644 index 000000000000..f87ee25c950c --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_run.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python get_test_run.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.get_test_run( + test_run_id="12316678-1234-1234-1234-122451189012", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/GetTestRun.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_run_file.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_run_file.py new file mode 100644 index 000000000000..436c8366180f --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_test_run_file.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python get_test_run_file.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.get_test_run_file( + test_run_id="12316678-1234-1234-1234-122451189012", + file_name="sample.jmx", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/GetTestRunFile.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_trigger.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_trigger.py new file mode 100644 index 000000000000..2f71e85d3e98 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/get_trigger.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python get_trigger.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.get_trigger( + trigger_id="12345678-1234-1234-1234-123456789012", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/GetTrigger.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_metric_dimension_values.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_metric_dimension_values.py new file mode 100644 index 000000000000..770026a15522 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_metric_dimension_values.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python list_metric_dimension_values.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.list_metric_dimension_values( + test_run_id="12316678-1234-1234-1234-122451189012", + name="SamplerName", + metric_name="ActiveThreads", + metric_namespace="LoadTestRunMetrics", + time_interval="2022-09-24T19:00:40Z/2022-09-25T19:28:40Z", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-03-01-preview/ListMetricDimensionValues.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_notification_rules.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_notification_rules.py new file mode 100644 index 000000000000..591d29c31a3b --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_notification_rules.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python list_notification_rules.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.list_notification_rules() + for item in response: + print(item) + + +# x-ms-original-file: 2025-03-01-preview/ListNotificationRules.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_app_components.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_app_components.py new file mode 100644 index 000000000000..b1551d3fb730 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_app_components.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python list_test_app_components.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.get_app_components( + test_id="ee843bd9-a6d4-4364-a45c-427a03c39fa7", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/ListTestAppComponents.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_files.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_files.py new file mode 100644 index 000000000000..886c3d4d471d --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_files.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python list_test_files.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.list_test_files( + test_id="12345678-1234-1234-1234-123456789012", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-03-01-preview/ListTestFiles.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_profile_runs.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_profile_runs.py new file mode 100644 index 000000000000..843bf60cee9d --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_profile_runs.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python list_test_profile_runs.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.list_test_profile_runs() + for item in response: + print(item) + + +# x-ms-original-file: 2025-03-01-preview/ListTestProfileRuns.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_profiles.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_profiles.py new file mode 100644 index 000000000000..2dff4cfde800 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_profiles.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python list_test_profiles.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.list_test_profiles() + for item in response: + print(item) + + +# x-ms-original-file: 2025-03-01-preview/ListTestProfiles.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_run_app_components.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_run_app_components.py new file mode 100644 index 000000000000..5ae73d86e000 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_run_app_components.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python list_test_run_app_components.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.get_app_components( + test_run_id="ee843bd9-a6d4-4364-a45c-427a03c39fa7", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/ListTestRunAppComponents.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_run_metrics.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_run_metrics.py new file mode 100644 index 000000000000..0e10cfeb03ab --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_run_metrics.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python list_test_run_metrics.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.list_metrics( + test_run_id="12316678-1234-1234-1234-122451189012", + metric_name="ActiveThreads", + metric_namespace="LoadTestRunMetrics", + time_interval="2022-09-24T19:00:40Z/2022-09-25T19:28:40Z", + ) + for item in response: + print(item) + + +# x-ms-original-file: 2025-03-01-preview/ListTestRunMetrics.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_run_metrics_definitions.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_run_metrics_definitions.py new file mode 100644 index 000000000000..42d9134f52e2 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_run_metrics_definitions.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python list_test_run_metrics_definitions.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.get_metric_definitions( + test_run_id="12316678-1234-1234-1234-122451189012", + metric_namespace="LoadTestRunMetrics", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/ListTestRunMetricsDefinitions.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_run_metrics_namespaces.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_run_metrics_namespaces.py new file mode 100644 index 000000000000..888540d2459b --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_run_metrics_namespaces.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python list_test_run_metrics_namespaces.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.get_metric_namespaces( + test_run_id="12316678-1234-1234-1234-122451189012", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/ListTestRunMetricsNamespaces.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_run_server_metrics_config.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_run_server_metrics_config.py new file mode 100644 index 000000000000..1dff41871885 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_run_server_metrics_config.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python list_test_run_server_metrics_config.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.get_server_metrics_config( + test_run_id="12345678-1234-1234-1234-123456789012", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/ListTestRunServerMetricsConfig.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_runs.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_runs.py new file mode 100644 index 000000000000..47d5a0c2d1d4 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_runs.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python list_test_runs.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.list_test_runs() + for item in response: + print(item) + + +# x-ms-original-file: 2025-03-01-preview/ListTestRuns.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_server_metrics_config.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_server_metrics_config.py new file mode 100644 index 000000000000..97c502551bc9 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_test_server_metrics_config.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python list_test_server_metrics_config.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.get_server_metrics_config( + test_id="12345678-1234-1234-1234-123456789012", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/ListTestServerMetricsConfig.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_tests.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_tests.py new file mode 100644 index 000000000000..74cd0a9709eb --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_tests.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python list_tests.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.list_tests() + for item in response: + print(item) + + +# x-ms-original-file: 2025-03-01-preview/ListTests.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_triggers.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_triggers.py new file mode 100644 index 000000000000..95210ba5df69 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/list_triggers.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestAdministrationClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python list_triggers.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.list_triggers() + for item in response: + print(item) + + +# x-ms-original-file: 2025-03-01-preview/ListTriggers.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/stop_test_profile_run.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/stop_test_profile_run.py new file mode 100644 index 000000000000..3f74c17b6082 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/stop_test_profile_run.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python stop_test_profile_run.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stop_test_profile_run( + test_profile_run_id="12316678-1234-1234-1234-122451189012", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/StopTestProfileRun.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_samples/stop_test_run.py b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/stop_test_run.py new file mode 100644 index 000000000000..0c987923cf7b --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_samples/stop_test_run.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.developer.loadtesting import LoadTestRunClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-developer-loadtesting +# USAGE + python stop_test_run.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = LoadTestAdministrationClient( + endpoint="ENDPOINT", + credential=DefaultAzureCredential(), + ) + + response = client.stop_test_run( + test_run_id="12316678-1234-1234-1234-122451189012", + ) + print(response) + + +# x-ms-original-file: 2025-03-01-preview/StopTestRun.json +if __name__ == "__main__": + main() diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_tests/conftest.py b/sdk/loadtesting/azure-developer-loadtesting/generated_tests/conftest.py new file mode 100644 index 000000000000..4350841161b5 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_tests/conftest.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + loadtestadministration_subscription_id = os.environ.get( + "LOADTESTADMINISTRATION_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + loadtestadministration_tenant_id = os.environ.get( + "LOADTESTADMINISTRATION_TENANT_ID", "00000000-0000-0000-0000-000000000000" + ) + loadtestadministration_client_id = os.environ.get( + "LOADTESTADMINISTRATION_CLIENT_ID", "00000000-0000-0000-0000-000000000000" + ) + loadtestadministration_client_secret = os.environ.get( + "LOADTESTADMINISTRATION_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=loadtestadministration_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer(regex=loadtestadministration_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=loadtestadministration_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer( + regex=loadtestadministration_client_secret, value="00000000-0000-0000-0000-000000000000" + ) + + loadtestrun_subscription_id = os.environ.get("LOADTESTRUN_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + loadtestrun_tenant_id = os.environ.get("LOADTESTRUN_TENANT_ID", "00000000-0000-0000-0000-000000000000") + loadtestrun_client_id = os.environ.get("LOADTESTRUN_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + loadtestrun_client_secret = os.environ.get("LOADTESTRUN_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=loadtestrun_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=loadtestrun_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=loadtestrun_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=loadtestrun_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_tests/test_load_test_administration.py b/sdk/loadtesting/azure-developer-loadtesting/generated_tests/test_load_test_administration.py new file mode 100644 index 000000000000..e38156333c24 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_tests/test_load_test_administration.py @@ -0,0 +1,482 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import LoadTestAdministrationClientTestBase, LoadTestAdministrationPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestLoadTestAdministration(LoadTestAdministrationClientTestBase): + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_create_or_update_test(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.create_or_update_test( + test_id="str", + body={ + "testId": "str", + "autoStopCriteria": { + "autoStopDisabled": bool, + "errorRate": 0.0, + "errorRateTimeWindowInSeconds": 0, + "maximumVirtualUsersPerEngine": 0, + }, + "baselineTestRunId": "str", + "certificate": {"name": "str", "type": "str", "value": "str"}, + "createdBy": "str", + "createdDateTime": "2020-02-20 00:00:00", + "description": "str", + "displayName": "str", + "engineBuiltInIdentityIds": ["str"], + "engineBuiltInIdentityType": "str", + "environmentVariables": {"str": "str"}, + "inputArtifacts": { + "additionalFileInfo": [ + { + "fileName": "str", + "expireDateTime": "2020-02-20 00:00:00", + "fileType": "str", + "url": "str", + "validationFailureDetails": "str", + "validationStatus": "str", + } + ], + "configFileInfo": { + "fileName": "str", + "expireDateTime": "2020-02-20 00:00:00", + "fileType": "str", + "url": "str", + "validationFailureDetails": "str", + "validationStatus": "str", + }, + "inputArtifactsZipFileInfo": { + "fileName": "str", + "expireDateTime": "2020-02-20 00:00:00", + "fileType": "str", + "url": "str", + "validationFailureDetails": "str", + "validationStatus": "str", + }, + "testScriptFileInfo": { + "fileName": "str", + "expireDateTime": "2020-02-20 00:00:00", + "fileType": "str", + "url": "str", + "validationFailureDetails": "str", + "validationStatus": "str", + }, + "urlTestConfigFileInfo": { + "fileName": "str", + "expireDateTime": "2020-02-20 00:00:00", + "fileType": "str", + "url": "str", + "validationFailureDetails": "str", + "validationStatus": "str", + }, + "userPropFileInfo": { + "fileName": "str", + "expireDateTime": "2020-02-20 00:00:00", + "fileType": "str", + "url": "str", + "validationFailureDetails": "str", + "validationStatus": "str", + }, + }, + "keyvaultReferenceIdentityId": "str", + "keyvaultReferenceIdentityType": "str", + "kind": "str", + "lastModifiedBy": "str", + "lastModifiedDateTime": "2020-02-20 00:00:00", + "loadTestConfiguration": { + "engineInstances": 0, + "optionalLoadTestConfig": { + "duration": 0, + "endpointUrl": "str", + "maxResponseTimeInMs": 0, + "rampUpTime": 0, + "requestsPerSecond": 0, + "virtualUsers": 0, + }, + "quickStartTest": bool, + "regionalLoadTestConfig": [{"engineInstances": 0, "region": "str"}], + "splitAllCSVs": bool, + }, + "metricsReferenceIdentityId": "str", + "metricsReferenceIdentityType": "str", + "passFailCriteria": { + "passFailMetrics": { + "str": { + "action": "str", + "actualValue": 0.0, + "aggregate": "str", + "clientMetric": "str", + "condition": "str", + "requestName": "str", + "result": "str", + "value": 0.0, + } + }, + "passFailServerMetrics": { + "str": { + "aggregation": "str", + "condition": "str", + "metricName": "str", + "metricNamespace": "str", + "resourceId": "str", + "value": 0.0, + "action": "str", + "actualValue": 0.0, + "result": "str", + } + }, + }, + "publicIPDisabled": bool, + "secrets": {"str": {"type": "str", "value": "str"}}, + "subnetId": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_create_or_update_app_components(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.create_or_update_app_components( + test_id="str", + body={ + "components": { + "str": { + "resourceId": "str", + "resourceName": "str", + "resourceType": "str", + "displayName": "str", + "kind": "str", + "resourceGroup": "str", + "subscriptionId": "str", + } + }, + "createdBy": "str", + "createdDateTime": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedDateTime": "2020-02-20 00:00:00", + "testId": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_create_or_update_server_metrics_config(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.create_or_update_server_metrics_config( + test_id="str", + body={ + "metrics": { + "str": { + "aggregation": "str", + "metricNamespace": "str", + "name": "str", + "resourceId": "str", + "resourceType": "str", + "displayDescription": "str", + "id": "str", + "unit": "str", + } + }, + "createdBy": "str", + "createdDateTime": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedDateTime": "2020-02-20 00:00:00", + "testId": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_get_app_components(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.get_app_components( + test_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_get_server_metrics_config(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.get_server_metrics_config( + test_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_get_test(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.get_test( + test_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_get_test_file(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.get_test_file( + test_id="str", + file_name="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_list_test_files(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.list_test_files( + test_id="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_list_tests(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.list_tests() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_delete_test_file(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.delete_test_file( + test_id="str", + file_name="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_delete_test(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.delete_test( + test_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_create_or_update_test_profile(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.create_or_update_test_profile( + test_profile_id="str", + body={ + "testProfileId": "str", + "createdBy": "str", + "createdDateTime": "2020-02-20 00:00:00", + "description": "str", + "displayName": "str", + "lastModifiedBy": "str", + "lastModifiedDateTime": "2020-02-20 00:00:00", + "targetResourceConfigurations": "target_resource_configurations", + "targetResourceId": "str", + "testId": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_delete_test_profile(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.delete_test_profile( + test_profile_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_get_test_profile(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.get_test_profile( + test_profile_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_list_test_profiles(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.list_test_profiles() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_create_or_update_trigger(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.create_or_update_trigger( + trigger_id="str", + body={ + "displayName": "str", + "kind": "ScheduleTestsTrigger", + "testIds": ["str"], + "triggerId": "str", + "createdBy": "str", + "createdDateTime": "2020-02-20 00:00:00", + "description": "str", + "lastModifiedBy": "str", + "lastModifiedDateTime": "2020-02-20 00:00:00", + "recurrence": "recurrence", + "recurrenceStatus": {"nextScheduledDateTimes": ["2020-02-20 00:00:00"], "remainingOccurrences": 0}, + "startDateTime": "2020-02-20 00:00:00", + "state": "str", + "stateDetails": {"message": "str"}, + }, + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_delete_trigger(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.delete_trigger( + trigger_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_get_trigger(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.get_trigger( + trigger_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_list_triggers(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.list_triggers() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_create_or_update_notification_rule(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.create_or_update_notification_rule( + notification_rule_id="str", + body={ + "actionGroupIds": ["str"], + "displayName": "str", + "eventFilters": {"str": "tests_notification_event_filter"}, + "notificationRuleId": "str", + "scope": "Tests", + "createdBy": "str", + "createdDateTime": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedDateTime": "2020-02-20 00:00:00", + "testIds": ["str"], + }, + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_delete_notification_rule(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.delete_notification_rule( + notification_rule_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_get_notification_rule(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.get_notification_rule( + notification_rule_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_list_notification_rules(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.list_notification_rules() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_begin_clone_test(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.begin_clone_test( + test_id="str", + body={"newTestId": "str", "description": "str", "displayName": "str"}, + new_test_id="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy + def test_get_operation_status(self, loadtestadministration_endpoint): + client = self.create_client(endpoint=loadtestadministration_endpoint) + response = client.get_operation_status( + operation_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_tests/test_load_test_administration_async.py b/sdk/loadtesting/azure-developer-loadtesting/generated_tests/test_load_test_administration_async.py new file mode 100644 index 000000000000..d12d26920876 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_tests/test_load_test_administration_async.py @@ -0,0 +1,485 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import LoadTestAdministrationPreparer +from testpreparer_async import LoadTestAdministrationClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestLoadTestAdministrationAsync(LoadTestAdministrationClientTestBaseAsync): + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_create_or_update_test(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.create_or_update_test( + test_id="str", + body={ + "testId": "str", + "autoStopCriteria": { + "autoStopDisabled": bool, + "errorRate": 0.0, + "errorRateTimeWindowInSeconds": 0, + "maximumVirtualUsersPerEngine": 0, + }, + "baselineTestRunId": "str", + "certificate": {"name": "str", "type": "str", "value": "str"}, + "createdBy": "str", + "createdDateTime": "2020-02-20 00:00:00", + "description": "str", + "displayName": "str", + "engineBuiltInIdentityIds": ["str"], + "engineBuiltInIdentityType": "str", + "environmentVariables": {"str": "str"}, + "inputArtifacts": { + "additionalFileInfo": [ + { + "fileName": "str", + "expireDateTime": "2020-02-20 00:00:00", + "fileType": "str", + "url": "str", + "validationFailureDetails": "str", + "validationStatus": "str", + } + ], + "configFileInfo": { + "fileName": "str", + "expireDateTime": "2020-02-20 00:00:00", + "fileType": "str", + "url": "str", + "validationFailureDetails": "str", + "validationStatus": "str", + }, + "inputArtifactsZipFileInfo": { + "fileName": "str", + "expireDateTime": "2020-02-20 00:00:00", + "fileType": "str", + "url": "str", + "validationFailureDetails": "str", + "validationStatus": "str", + }, + "testScriptFileInfo": { + "fileName": "str", + "expireDateTime": "2020-02-20 00:00:00", + "fileType": "str", + "url": "str", + "validationFailureDetails": "str", + "validationStatus": "str", + }, + "urlTestConfigFileInfo": { + "fileName": "str", + "expireDateTime": "2020-02-20 00:00:00", + "fileType": "str", + "url": "str", + "validationFailureDetails": "str", + "validationStatus": "str", + }, + "userPropFileInfo": { + "fileName": "str", + "expireDateTime": "2020-02-20 00:00:00", + "fileType": "str", + "url": "str", + "validationFailureDetails": "str", + "validationStatus": "str", + }, + }, + "keyvaultReferenceIdentityId": "str", + "keyvaultReferenceIdentityType": "str", + "kind": "str", + "lastModifiedBy": "str", + "lastModifiedDateTime": "2020-02-20 00:00:00", + "loadTestConfiguration": { + "engineInstances": 0, + "optionalLoadTestConfig": { + "duration": 0, + "endpointUrl": "str", + "maxResponseTimeInMs": 0, + "rampUpTime": 0, + "requestsPerSecond": 0, + "virtualUsers": 0, + }, + "quickStartTest": bool, + "regionalLoadTestConfig": [{"engineInstances": 0, "region": "str"}], + "splitAllCSVs": bool, + }, + "metricsReferenceIdentityId": "str", + "metricsReferenceIdentityType": "str", + "passFailCriteria": { + "passFailMetrics": { + "str": { + "action": "str", + "actualValue": 0.0, + "aggregate": "str", + "clientMetric": "str", + "condition": "str", + "requestName": "str", + "result": "str", + "value": 0.0, + } + }, + "passFailServerMetrics": { + "str": { + "aggregation": "str", + "condition": "str", + "metricName": "str", + "metricNamespace": "str", + "resourceId": "str", + "value": 0.0, + "action": "str", + "actualValue": 0.0, + "result": "str", + } + }, + }, + "publicIPDisabled": bool, + "secrets": {"str": {"type": "str", "value": "str"}}, + "subnetId": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_create_or_update_app_components(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.create_or_update_app_components( + test_id="str", + body={ + "components": { + "str": { + "resourceId": "str", + "resourceName": "str", + "resourceType": "str", + "displayName": "str", + "kind": "str", + "resourceGroup": "str", + "subscriptionId": "str", + } + }, + "createdBy": "str", + "createdDateTime": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedDateTime": "2020-02-20 00:00:00", + "testId": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_create_or_update_server_metrics_config(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.create_or_update_server_metrics_config( + test_id="str", + body={ + "metrics": { + "str": { + "aggregation": "str", + "metricNamespace": "str", + "name": "str", + "resourceId": "str", + "resourceType": "str", + "displayDescription": "str", + "id": "str", + "unit": "str", + } + }, + "createdBy": "str", + "createdDateTime": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedDateTime": "2020-02-20 00:00:00", + "testId": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_get_app_components(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.get_app_components( + test_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_get_server_metrics_config(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.get_server_metrics_config( + test_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_get_test(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.get_test( + test_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_get_test_file(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.get_test_file( + test_id="str", + file_name="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_list_test_files(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = client.list_test_files( + test_id="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_list_tests(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = client.list_tests() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_delete_test_file(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.delete_test_file( + test_id="str", + file_name="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_delete_test(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.delete_test( + test_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_create_or_update_test_profile(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.create_or_update_test_profile( + test_profile_id="str", + body={ + "testProfileId": "str", + "createdBy": "str", + "createdDateTime": "2020-02-20 00:00:00", + "description": "str", + "displayName": "str", + "lastModifiedBy": "str", + "lastModifiedDateTime": "2020-02-20 00:00:00", + "targetResourceConfigurations": "target_resource_configurations", + "targetResourceId": "str", + "testId": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_delete_test_profile(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.delete_test_profile( + test_profile_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_get_test_profile(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.get_test_profile( + test_profile_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_list_test_profiles(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = client.list_test_profiles() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_create_or_update_trigger(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.create_or_update_trigger( + trigger_id="str", + body={ + "displayName": "str", + "kind": "ScheduleTestsTrigger", + "testIds": ["str"], + "triggerId": "str", + "createdBy": "str", + "createdDateTime": "2020-02-20 00:00:00", + "description": "str", + "lastModifiedBy": "str", + "lastModifiedDateTime": "2020-02-20 00:00:00", + "recurrence": "recurrence", + "recurrenceStatus": {"nextScheduledDateTimes": ["2020-02-20 00:00:00"], "remainingOccurrences": 0}, + "startDateTime": "2020-02-20 00:00:00", + "state": "str", + "stateDetails": {"message": "str"}, + }, + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_delete_trigger(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.delete_trigger( + trigger_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_get_trigger(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.get_trigger( + trigger_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_list_triggers(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = client.list_triggers() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_create_or_update_notification_rule(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.create_or_update_notification_rule( + notification_rule_id="str", + body={ + "actionGroupIds": ["str"], + "displayName": "str", + "eventFilters": {"str": "tests_notification_event_filter"}, + "notificationRuleId": "str", + "scope": "Tests", + "createdBy": "str", + "createdDateTime": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedDateTime": "2020-02-20 00:00:00", + "testIds": ["str"], + }, + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_delete_notification_rule(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.delete_notification_rule( + notification_rule_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_get_notification_rule(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.get_notification_rule( + notification_rule_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_list_notification_rules(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = client.list_notification_rules() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_begin_clone_test(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await ( + await client.begin_clone_test( + test_id="str", + body={"newTestId": "str", "description": "str", "displayName": "str"}, + new_test_id="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @LoadTestAdministrationPreparer() + @recorded_by_proxy_async + async def test_get_operation_status(self, loadtestadministration_endpoint): + client = self.create_async_client(endpoint=loadtestadministration_endpoint) + response = await client.get_operation_status( + operation_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_tests/test_load_test_run.py b/sdk/loadtesting/azure-developer-loadtesting/generated_tests/test_load_test_run.py new file mode 100644 index 000000000000..895274de2057 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_tests/test_load_test_run.py @@ -0,0 +1,242 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import LoadTestRunClientTestBase, LoadTestRunPreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestLoadTestRun(LoadTestRunClientTestBase): + @LoadTestRunPreparer() + @recorded_by_proxy + def test_create_or_update_app_components(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.create_or_update_app_components( + test_run_id="str", + body={ + "components": { + "str": { + "resourceId": "str", + "resourceName": "str", + "resourceType": "str", + "displayName": "str", + "kind": "str", + "resourceGroup": "str", + "subscriptionId": "str", + } + }, + "createdBy": "str", + "createdDateTime": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedDateTime": "2020-02-20 00:00:00", + "testRunId": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy + def test_create_or_update_server_metrics_config(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.create_or_update_server_metrics_config( + test_run_id="str", + body={ + "createdBy": "str", + "createdDateTime": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedDateTime": "2020-02-20 00:00:00", + "metrics": { + "str": { + "aggregation": "str", + "metricNamespace": "str", + "name": "str", + "resourceId": "str", + "resourceType": "str", + "displayDescription": "str", + "id": "str", + "unit": "str", + } + }, + "testRunId": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy + def test_delete_test_run(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.delete_test_run( + test_run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy + def test_get_app_components(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.get_app_components( + test_run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy + def test_get_server_metrics_config(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.get_server_metrics_config( + test_run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy + def test_get_test_run(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.get_test_run( + test_run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy + def test_get_test_run_file(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.get_test_run_file( + test_run_id="str", + file_name="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy + def test_list_metric_dimension_values(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.list_metric_dimension_values( + test_run_id="str", + name="str", + metric_name="str", + metric_namespace="str", + time_interval="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy + def test_get_metric_definitions(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.get_metric_definitions( + test_run_id="str", + metric_namespace="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy + def test_get_metric_namespaces(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.get_metric_namespaces( + test_run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy + def test_list_metrics(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.list_metrics( + test_run_id="str", + metric_name="str", + metric_namespace="str", + time_interval="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy + def test_list_test_runs(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.list_test_runs() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy + def test_stop_test_run(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.stop_test_run( + test_run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy + def test_delete_test_profile_run(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.delete_test_profile_run( + test_profile_run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy + def test_get_test_profile_run(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.get_test_profile_run( + test_profile_run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy + def test_list_test_profile_runs(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.list_test_profile_runs() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy + def test_stop_test_profile_run(self, loadtestrun_endpoint): + client = self.create_client(endpoint=loadtestrun_endpoint) + response = client.stop_test_profile_run( + test_profile_run_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_tests/test_load_test_run_async.py b/sdk/loadtesting/azure-developer-loadtesting/generated_tests/test_load_test_run_async.py new file mode 100644 index 000000000000..963c78291566 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_tests/test_load_test_run_async.py @@ -0,0 +1,243 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import LoadTestRunPreparer +from testpreparer_async import LoadTestRunClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestLoadTestRunAsync(LoadTestRunClientTestBaseAsync): + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_create_or_update_app_components(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = await client.create_or_update_app_components( + test_run_id="str", + body={ + "components": { + "str": { + "resourceId": "str", + "resourceName": "str", + "resourceType": "str", + "displayName": "str", + "kind": "str", + "resourceGroup": "str", + "subscriptionId": "str", + } + }, + "createdBy": "str", + "createdDateTime": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedDateTime": "2020-02-20 00:00:00", + "testRunId": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_create_or_update_server_metrics_config(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = await client.create_or_update_server_metrics_config( + test_run_id="str", + body={ + "createdBy": "str", + "createdDateTime": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedDateTime": "2020-02-20 00:00:00", + "metrics": { + "str": { + "aggregation": "str", + "metricNamespace": "str", + "name": "str", + "resourceId": "str", + "resourceType": "str", + "displayDescription": "str", + "id": "str", + "unit": "str", + } + }, + "testRunId": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_delete_test_run(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = await client.delete_test_run( + test_run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_get_app_components(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = await client.get_app_components( + test_run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_get_server_metrics_config(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = await client.get_server_metrics_config( + test_run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_get_test_run(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = await client.get_test_run( + test_run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_get_test_run_file(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = await client.get_test_run_file( + test_run_id="str", + file_name="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_list_metric_dimension_values(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = client.list_metric_dimension_values( + test_run_id="str", + name="str", + metric_name="str", + metric_namespace="str", + time_interval="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_get_metric_definitions(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = await client.get_metric_definitions( + test_run_id="str", + metric_namespace="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_get_metric_namespaces(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = await client.get_metric_namespaces( + test_run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_list_metrics(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = client.list_metrics( + test_run_id="str", + metric_name="str", + metric_namespace="str", + time_interval="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_list_test_runs(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = client.list_test_runs() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_stop_test_run(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = await client.stop_test_run( + test_run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_delete_test_profile_run(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = await client.delete_test_profile_run( + test_profile_run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_get_test_profile_run(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = await client.get_test_profile_run( + test_profile_run_id="str", + ) + + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_list_test_profile_runs(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = client.list_test_profile_runs() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @LoadTestRunPreparer() + @recorded_by_proxy_async + async def test_stop_test_profile_run(self, loadtestrun_endpoint): + client = self.create_async_client(endpoint=loadtestrun_endpoint) + response = await client.stop_test_profile_run( + test_profile_run_id="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_tests/testpreparer.py b/sdk/loadtesting/azure-developer-loadtesting/generated_tests/testpreparer.py new file mode 100644 index 000000000000..d2a65a724bdf --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_tests/testpreparer.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.developer.loadtesting import LoadTestAdministrationClient, LoadTestRunClient +from devtools_testutils import AzureRecordedTestCase, PowerShellPreparer +import functools + + +class LoadTestAdministrationClientTestBase(AzureRecordedTestCase): + + def create_client(self, endpoint): + credential = self.get_credential(LoadTestAdministrationClient) + return self.create_client_from_credential( + LoadTestAdministrationClient, + credential=credential, + endpoint=endpoint, + ) + + +LoadTestAdministrationPreparer = functools.partial( + PowerShellPreparer, + "loadtestadministration", + loadtestadministration_endpoint="https://fake_loadtestadministration_endpoint.com", +) + + +class LoadTestRunClientTestBase(AzureRecordedTestCase): + + def create_client(self, endpoint): + credential = self.get_credential(LoadTestRunClient) + return self.create_client_from_credential( + LoadTestRunClient, + credential=credential, + endpoint=endpoint, + ) + + +LoadTestRunPreparer = functools.partial( + PowerShellPreparer, "loadtestrun", loadtestrun_endpoint="https://fake_loadtestrun_endpoint.com" +) diff --git a/sdk/loadtesting/azure-developer-loadtesting/generated_tests/testpreparer_async.py b/sdk/loadtesting/azure-developer-loadtesting/generated_tests/testpreparer_async.py new file mode 100644 index 000000000000..a45d09fcf9b4 --- /dev/null +++ b/sdk/loadtesting/azure-developer-loadtesting/generated_tests/testpreparer_async.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from azure.developer.loadtesting.aio import LoadTestAdministrationClient, LoadTestRunClient +from devtools_testutils import AzureRecordedTestCase + + +class LoadTestAdministrationClientTestBaseAsync(AzureRecordedTestCase): + + def create_async_client(self, endpoint): + credential = self.get_credential(LoadTestAdministrationClient, is_async=True) + return self.create_client_from_credential( + LoadTestAdministrationClient, + credential=credential, + endpoint=endpoint, + ) + + +class LoadTestRunClientTestBaseAsync(AzureRecordedTestCase): + + def create_async_client(self, endpoint): + credential = self.get_credential(LoadTestRunClient, is_async=True) + return self.create_client_from_credential( + LoadTestRunClient, + credential=credential, + endpoint=endpoint, + ) diff --git a/sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_app_components_test.py b/sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_app_components_test.py index 79adb48c202b..8cfc28a1de29 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_app_components_test.py +++ b/sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_app_components_test.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for diff --git a/sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_test.py b/sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_test.py index 36b793be030d..402294d5b89d 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_test.py +++ b/sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_test.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for diff --git a/sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_test_profile.py b/sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_test_profile.py index 6d19b26a3aca..b49976147e7c 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_test_profile.py +++ b/sdk/loadtesting/azure-developer-loadtesting/samples/create_or_update_test_profile.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for @@ -59,9 +60,9 @@ "config2": { "instanceMemoryMB": 4096, "httpConcurrency": 100, - } - } - } + }, + }, + }, }, ) diff --git a/sdk/loadtesting/azure-developer-loadtesting/samples/upload_test_file.py b/sdk/loadtesting/azure-developer-loadtesting/samples/upload_test_file.py index ed8380e6ca39..1c8c7fbe5d0e 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/samples/upload_test_file.py +++ b/sdk/loadtesting/azure-developer-loadtesting/samples/upload_test_file.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for diff --git a/sdk/loadtesting/azure-developer-loadtesting/setup.py b/sdk/loadtesting/azure-developer-loadtesting/setup.py index 0d0752f9040b..1297cc5c96fd 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/setup.py +++ b/sdk/loadtesting/azure-developer-loadtesting/setup.py @@ -5,7 +5,7 @@ # Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -# coding: utf-8 + import os import re @@ -29,7 +29,7 @@ setup( name=PACKAGE_NAME, version=version, - description="Microsoft {} Client Library for Python".format(PACKAGE_PPRINT_NAME), + description="Microsoft Corporation {} Client Library for Python".format(PACKAGE_PPRINT_NAME), long_description=open("README.md", "r").read(), long_description_content_type="text/markdown", license="MIT License", @@ -42,7 +42,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -67,5 +66,5 @@ "azure-core>=1.30.0", "typing-extensions>=4.6.0", ], - python_requires=">=3.8", + python_requires=">=3.9", ) diff --git a/sdk/loadtesting/azure-developer-loadtesting/tests/test_async_load_test_administration_ops.py b/sdk/loadtesting/azure-developer-loadtesting/tests/test_async_load_test_administration_ops.py index 655cfce51f17..69232f7a0183 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/tests/test_async_load_test_administration_ops.py +++ b/sdk/loadtesting/azure-developer-loadtesting/tests/test_async_load_test_administration_ops.py @@ -16,6 +16,7 @@ DISPLAY_NAME = "TestingResourcePyTest" + class TestLoadTestAdministrationOperations(LoadTestingAsyncTest): @LoadTestingPreparer() @@ -36,8 +37,18 @@ async def test_create_or_update_load_test(self, loadtesting_endpoint, loadtestin }, "passFailCriteria": { "passFailMetrics": { - "condition1": {"clientmetric": "response_time_ms", "aggregate": "avg", "condition": ">", "value": 300}, - "condition2": {"clientmetric": "error", "aggregate": "percentage", "condition": ">", "value": 50}, + "condition1": { + "clientmetric": "response_time_ms", + "aggregate": "avg", + "condition": ">", + "value": 300, + }, + "condition2": { + "clientmetric": "error", + "aggregate": "percentage", + "condition": ">", + "value": 50, + }, "condition3": { "clientmetric": "latency", "aggregate": "avg", @@ -49,7 +60,8 @@ async def test_create_or_update_load_test(self, loadtesting_endpoint, loadtestin }, "secrets": {}, "environmentVariables": {"my-variable": "value"}, - }) + }, + ) assert result is not None await self.close_admin_client() @@ -137,7 +149,7 @@ async def test_delete_test_file(self, loadtesting_endpoint, loadtesting_test_id) assert result is None await self.close_admin_client() - + @LoadTestingPreparer() @recorded_by_proxy_async @pytest.mark.asyncio @@ -230,6 +242,7 @@ async def test_delete_load_test(self, loadtesting_endpoint, loadtesting_test_id) await self.close_admin_client() + class TestTestProfileAdministrationOperations(LoadTestingAsyncTest): @LoadTestingPreparer() @@ -250,8 +263,18 @@ async def test_create_or_update_load_test(self, loadtesting_endpoint, loadtestin }, "passFailCriteria": { "passFailMetrics": { - "condition1": {"clientmetric": "response_time_ms", "aggregate": "avg", "condition": ">", "value": 300}, - "condition2": {"clientmetric": "error", "aggregate": "percentage", "condition": ">", "value": 50}, + "condition1": { + "clientmetric": "response_time_ms", + "aggregate": "avg", + "condition": ">", + "value": 300, + }, + "condition2": { + "clientmetric": "error", + "aggregate": "percentage", + "condition": ">", + "value": 50, + }, "condition3": { "clientmetric": "latency", "aggregate": "avg", @@ -263,7 +286,8 @@ async def test_create_or_update_load_test(self, loadtesting_endpoint, loadtestin }, "secrets": {}, "environmentVariables": {"my-variable": "value"}, - }) + }, + ) assert result is not None await self.close_admin_client() @@ -283,7 +307,9 @@ async def test_get_load_test(self, loadtesting_endpoint, loadtesting_test_id): @LoadTestingPreparer() @recorded_by_proxy_async @pytest.mark.asyncio - async def test_create_or_update_test_profile(self, loadtesting_endpoint, loadtesting_test_id, loadtesting_test_profile_id, loadtesting_target_resource_id): + async def test_create_or_update_test_profile( + self, loadtesting_endpoint, loadtesting_test_id, loadtesting_test_profile_id, loadtesting_target_resource_id + ): set_bodiless_matcher() client = self.create_administration_client(loadtesting_endpoint) @@ -297,16 +323,10 @@ async def test_create_or_update_test_profile(self, loadtesting_endpoint, loadtes "targetResourceConfigurations": { "kind": "FunctionsFlexConsumption", "configurations": { - "config1": { - "instanceMemoryMB": 2048, - "httpConcurrency": 20 - }, - "config2": { - "instanceMemoryMB": 4096, - "httpConcurrency": 100 - }, - } - } + "config1": {"instanceMemoryMB": 2048, "httpConcurrency": 20}, + "config2": {"instanceMemoryMB": 4096, "httpConcurrency": 100}, + }, + }, }, ) @@ -318,7 +338,7 @@ async def test_create_or_update_test_profile(self, loadtesting_endpoint, loadtes @pytest.mark.asyncio async def test_get_test_profile(self, loadtesting_endpoint, loadtesting_test_profile_id): set_bodiless_matcher() - + client = self.create_administration_client(loadtesting_endpoint) result = await client.get_test_profile(loadtesting_test_profile_id) assert result is not None @@ -330,7 +350,7 @@ async def test_get_test_profile(self, loadtesting_endpoint, loadtesting_test_pro @pytest.mark.asyncio async def test_list_test_profiles(self, loadtesting_endpoint): set_bodiless_matcher() - + client = self.create_administration_client(loadtesting_endpoint) result = client.list_test_profiles() assert result is not None diff --git a/sdk/loadtesting/azure-developer-loadtesting/tests/test_async_load_test_run_ops.py b/sdk/loadtesting/azure-developer-loadtesting/tests/test_async_load_test_run_ops.py index a35c670296df..c00da04555ee 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/tests/test_async_load_test_run_ops.py +++ b/sdk/loadtesting/azure-developer-loadtesting/tests/test_async_load_test_run_ops.py @@ -17,6 +17,7 @@ DISPLAY_NAME = "TestingResourcePyTest" NON_EXISTING_RESOURCE = "nonexistingresource" + class TestLoadTestRunOperations(LoadTestingAsyncTest): # Pre-requisite: Test creation is needed for test run related tests @@ -37,8 +38,18 @@ async def test_create_or_update_load_test(self, loadtesting_endpoint, loadtestin }, "passFailCriteria": { "passFailMetrics": { - "condition1": {"clientmetric": "response_time_ms", "aggregate": "avg", "condition": ">", "value": 300}, - "condition2": {"clientmetric": "error", "aggregate": "percentage", "condition": ">", "value": 50}, + "condition1": { + "clientmetric": "response_time_ms", + "aggregate": "avg", + "condition": ">", + "value": 300, + }, + "condition2": { + "clientmetric": "error", + "aggregate": "percentage", + "condition": ">", + "value": 50, + }, "condition3": { "clientmetric": "latency", "aggregate": "avg", @@ -50,7 +61,8 @@ async def test_create_or_update_load_test(self, loadtesting_endpoint, loadtestin }, "secrets": {}, "environmentVariables": {"my-variable": "value"}, - }) + }, + ) assert result is not None @@ -66,7 +78,7 @@ async def test_get_load_test(self, loadtesting_endpoint, loadtesting_test_id): assert result is not None await self.close_admin_client() - + @LoadTestingPreparer() @recorded_by_proxy_async async def test_upload_test_file(self, loadtesting_endpoint, loadtesting_test_id): @@ -154,7 +166,7 @@ async def test_list_test_runs(self, loadtesting_endpoint): result = run_client.list_test_runs() assert result is not None items = [item async for item in result] - assert len(items) > 0 # Atleast one item in the page + assert len(items) > 0 # Atleast one item in the page await self.close_run_client() @@ -217,9 +229,7 @@ async def test_create_or_update_app_component( @LoadTestingPreparer() @recorded_by_proxy_async - async def test_get_app_component( - self, loadtesting_endpoint, loadtesting_test_run_id - ): + async def test_get_app_component(self, loadtesting_endpoint, loadtesting_test_run_id): set_bodiless_matcher() run_client = self.create_run_client(loadtesting_endpoint) @@ -260,9 +270,7 @@ async def test_create_or_update_server_metrics_config( @LoadTestingPreparer() @recorded_by_proxy_async - async def test_get_server_metrics_config( - self, loadtesting_endpoint, loadtesting_test_run_id - ): + async def test_get_server_metrics_config(self, loadtesting_endpoint, loadtesting_test_run_id): set_bodiless_matcher() run_client = self.create_run_client(loadtesting_endpoint) @@ -302,7 +310,7 @@ async def test_delete_test_run(self, loadtesting_endpoint, loadtesting_test_run_ assert result is None await self.close_run_client() - + @LoadTestingPreparer() @recorded_by_proxy_async async def test_delete_test(self, loadtesting_endpoint, loadtesting_test_id): @@ -315,6 +323,7 @@ async def test_delete_test(self, loadtesting_endpoint, loadtesting_test_id): await self.close_admin_client() + class TestTestProfileRunOperations(LoadTestingAsyncTest): # Pre-requisite: Test & Test Profile creation is needed for test profile run related tests @@ -335,8 +344,18 @@ async def test_create_or_update_load_test(self, loadtesting_endpoint, loadtestin }, "passFailCriteria": { "passFailMetrics": { - "condition1": {"clientmetric": "response_time_ms", "aggregate": "avg", "condition": ">", "value": 300}, - "condition2": {"clientmetric": "error", "aggregate": "percentage", "condition": ">", "value": 50}, + "condition1": { + "clientmetric": "response_time_ms", + "aggregate": "avg", + "condition": ">", + "value": 300, + }, + "condition2": { + "clientmetric": "error", + "aggregate": "percentage", + "condition": ">", + "value": 50, + }, "condition3": { "clientmetric": "latency", "aggregate": "avg", @@ -398,7 +417,9 @@ async def test_get_test_file(self, loadtesting_endpoint, loadtesting_test_id): @LoadTestingPreparer() @recorded_by_proxy_async - async def test_create_or_update_test_profile(self, loadtesting_endpoint, loadtesting_test_id, loadtesting_test_profile_id, loadtesting_target_resource_id): + async def test_create_or_update_test_profile( + self, loadtesting_endpoint, loadtesting_test_id, loadtesting_test_profile_id, loadtesting_target_resource_id + ): set_bodiless_matcher() client = self.create_administration_client(loadtesting_endpoint) @@ -412,16 +433,10 @@ async def test_create_or_update_test_profile(self, loadtesting_endpoint, loadtes "targetResourceConfigurations": { "kind": "FunctionsFlexConsumption", "configurations": { - "config1": { - "instanceMemoryMB": 2048, - "httpConcurrency": 20 - }, - "config2": { - "instanceMemoryMB": 4096, - "httpConcurrency": 100 - }, - } - } + "config1": {"instanceMemoryMB": 2048, "httpConcurrency": 20}, + "config2": {"instanceMemoryMB": 4096, "httpConcurrency": 100}, + }, + }, }, ) assert result is not None @@ -441,7 +456,9 @@ async def test_get_test_profile(self, loadtesting_endpoint, loadtesting_test_pro @LoadTestingPreparer() @recorded_by_proxy_async - async def test_begin_test_profile_run(self, loadtesting_endpoint, loadtesting_test_profile_id, loadtesting_test_profile_run_id): + async def test_begin_test_profile_run( + self, loadtesting_endpoint, loadtesting_test_profile_id, loadtesting_test_profile_run_id + ): set_bodiless_matcher() run_client = self.create_run_client(loadtesting_endpoint) diff --git a/sdk/loadtesting/azure-developer-loadtesting/tests/test_load_test_administration_ops.py b/sdk/loadtesting/azure-developer-loadtesting/tests/test_load_test_administration_ops.py index 22b217d8200e..25ee309e1019 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/tests/test_load_test_administration_ops.py +++ b/sdk/loadtesting/azure-developer-loadtesting/tests/test_load_test_administration_ops.py @@ -14,6 +14,7 @@ DISPLAY_NAME = "TestingResourcePyTest" + class TestLoadTestAdministrationOperations(LoadTestingTest): @LoadTestingPreparer() @@ -33,8 +34,18 @@ def test_create_or_update_load_test(self, loadtesting_endpoint, loadtesting_test }, "passFailCriteria": { "passFailMetrics": { - "condition1": {"clientmetric": "response_time_ms", "aggregate": "avg", "condition": ">", "value": 300}, - "condition2": {"clientmetric": "error", "aggregate": "percentage", "condition": ">", "value": 50}, + "condition1": { + "clientmetric": "response_time_ms", + "aggregate": "avg", + "condition": ">", + "value": 300, + }, + "condition2": { + "clientmetric": "error", + "aggregate": "percentage", + "condition": ">", + "value": 50, + }, "condition3": { "clientmetric": "latency", "aggregate": "avg", @@ -46,7 +57,8 @@ def test_create_or_update_load_test(self, loadtesting_endpoint, loadtesting_test }, "secrets": {}, "environmentVariables": {"my-variable": "value"}, - }) + }, + ) assert result is not None @@ -110,7 +122,8 @@ def list_test_files(self, loadtesting_endpoint, loadtesting_test_id): @LoadTestingPreparer() @recorded_by_proxy def test_create_or_update_app_components( - self, loadtesting_endpoint, loadtesting_test_id, loadtesting_app_component_id): + self, loadtesting_endpoint, loadtesting_test_id, loadtesting_app_component_id + ): set_bodiless_matcher() client = self.create_administration_client(loadtesting_endpoint) @@ -181,7 +194,7 @@ def test_delete_test_file(self, loadtesting_endpoint, loadtesting_test_id): client = self.create_administration_client(loadtesting_endpoint) result = client.delete_test_file(loadtesting_test_id, "sample.jmx") assert result is None - + @LoadTestingPreparer() @recorded_by_proxy def test_delete_load_test(self, loadtesting_endpoint, loadtesting_test_id): @@ -191,6 +204,7 @@ def test_delete_load_test(self, loadtesting_endpoint, loadtesting_test_id): result = client.delete_test(loadtesting_test_id) assert result is None + class TestTestProfileAdministrationOperations(LoadTestingTest): # Pre-requisite: Test creation is needed for test profile related tests @@ -211,8 +225,18 @@ def test_create_or_update_load_test(self, loadtesting_endpoint, loadtesting_test }, "passFailCriteria": { "passFailMetrics": { - "condition1": {"clientmetric": "response_time_ms", "aggregate": "avg", "condition": ">", "value": 300}, - "condition2": {"clientmetric": "error", "aggregate": "percentage", "condition": ">", "value": 50}, + "condition1": { + "clientmetric": "response_time_ms", + "aggregate": "avg", + "condition": ">", + "value": 300, + }, + "condition2": { + "clientmetric": "error", + "aggregate": "percentage", + "condition": ">", + "value": 50, + }, "condition3": { "clientmetric": "latency", "aggregate": "avg", @@ -224,7 +248,8 @@ def test_create_or_update_load_test(self, loadtesting_endpoint, loadtesting_test }, "secrets": {}, "environmentVariables": {"my-variable": "value"}, - }) + }, + ) assert result is not None @@ -239,7 +264,9 @@ def test_get_load_test(self, loadtesting_endpoint, loadtesting_test_id): @LoadTestingPreparer() @recorded_by_proxy - def test_create_or_update_test_profile(self, loadtesting_endpoint, loadtesting_test_id, loadtesting_test_profile_id, loadtesting_target_resource_id): + def test_create_or_update_test_profile( + self, loadtesting_endpoint, loadtesting_test_id, loadtesting_test_profile_id, loadtesting_target_resource_id + ): set_bodiless_matcher() client = self.create_administration_client(loadtesting_endpoint) @@ -253,20 +280,14 @@ def test_create_or_update_test_profile(self, loadtesting_endpoint, loadtesting_t "targetResourceConfigurations": { "kind": "FunctionsFlexConsumption", "configurations": { - "config1": { - "instanceMemoryMB": 2048, - "httpConcurrency": 20 - }, - "config2": { - "instanceMemoryMB": 4096, - "httpConcurrency": 100 - }, - } - } + "config1": {"instanceMemoryMB": 2048, "httpConcurrency": 20}, + "config2": {"instanceMemoryMB": 4096, "httpConcurrency": 100}, + }, + }, }, ) assert result is not None - + @LoadTestingPreparer() @recorded_by_proxy def test_get_test_profile(self, loadtesting_endpoint, loadtesting_test_profile_id): @@ -286,7 +307,7 @@ def test_list_test_profiles(self, loadtesting_endpoint): assert result is not None items = [r for r in result] assert len(items) > 0 # page has atleast one item - + @LoadTestingPreparer() @recorded_by_proxy def test_delete_test_profile(self, loadtesting_endpoint, loadtesting_test_profile_id): diff --git a/sdk/loadtesting/azure-developer-loadtesting/tests/test_load_test_run_ops.py b/sdk/loadtesting/azure-developer-loadtesting/tests/test_load_test_run_ops.py index be5b5d5efa29..ab60ea9c712b 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/tests/test_load_test_run_ops.py +++ b/sdk/loadtesting/azure-developer-loadtesting/tests/test_load_test_run_ops.py @@ -35,8 +35,18 @@ def test_create_or_update_load_test(self, loadtesting_endpoint, loadtesting_test }, "passFailCriteria": { "passFailMetrics": { - "condition1": {"clientmetric": "response_time_ms", "aggregate": "avg", "condition": ">", "value": 300}, - "condition2": {"clientmetric": "error", "aggregate": "percentage", "condition": ">", "value": 50}, + "condition1": { + "clientmetric": "response_time_ms", + "aggregate": "avg", + "condition": ">", + "value": 300, + }, + "condition2": { + "clientmetric": "error", + "aggregate": "percentage", + "condition": ">", + "value": 50, + }, "condition3": { "clientmetric": "latency", "aggregate": "avg", @@ -48,7 +58,8 @@ def test_create_or_update_load_test(self, loadtesting_endpoint, loadtesting_test }, "secrets": {}, "environmentVariables": {"my-variable": "value"}, - }) + }, + ) assert result is not None @@ -60,7 +71,7 @@ def test_get_load_test(self, loadtesting_endpoint, loadtesting_test_id): client = self.create_administration_client(loadtesting_endpoint) result = client.get_test(loadtesting_test_id) assert result is not None - + @LoadTestingPreparer() @recorded_by_proxy def test_upload_test_file(self, loadtesting_endpoint, loadtesting_test_id): @@ -138,7 +149,7 @@ def test_list_test_runs(self, loadtesting_endpoint, loadtesting_test_id, loadtes result = run_client.list_test_runs() assert result is not None items = [item for item in result] - assert len(items) > 0 # Atleast one item in the page + assert len(items) > 0 # Atleast one item in the page @LoadTestingPreparer() @recorded_by_proxy @@ -195,9 +206,7 @@ def test_create_or_update_app_component( @LoadTestingPreparer() @recorded_by_proxy - def test_get_app_component( - self, loadtesting_endpoint, loadtesting_test_run_id - ): + def test_get_app_component(self, loadtesting_endpoint, loadtesting_test_run_id): set_bodiless_matcher() run_client = self.create_run_client(loadtesting_endpoint) @@ -234,9 +243,7 @@ def test_create_or_update_server_metrics_config( @LoadTestingPreparer() @recorded_by_proxy - def test_get_server_metrics_config( - self, loadtesting_endpoint, loadtesting_test_run_id - ): + def test_get_server_metrics_config(self, loadtesting_endpoint, loadtesting_test_run_id): set_bodiless_matcher() run_client = self.create_run_client(loadtesting_endpoint) @@ -275,7 +282,7 @@ def test_delete_test_run(self, loadtesting_endpoint, loadtesting_test_run_id): result = run_client.delete_test_run(loadtesting_test_run_id) assert result is None - + @LoadTestingPreparer() @recorded_by_proxy def test_delete_test(self, loadtesting_endpoint, loadtesting_test_id): @@ -286,6 +293,7 @@ def test_delete_test(self, loadtesting_endpoint, loadtesting_test_id): result = client.delete_test(loadtesting_test_id) assert result is None + class TestTestProfileRunOperations(LoadTestingTest): # Pre-requisite: Test & Test Profile creation is needed for test profile run related tests @@ -306,8 +314,18 @@ def test_create_or_update_load_test(self, loadtesting_endpoint, loadtesting_test }, "passFailCriteria": { "passFailMetrics": { - "condition1": {"clientmetric": "response_time_ms", "aggregate": "avg", "condition": ">", "value": 300}, - "condition2": {"clientmetric": "error", "aggregate": "percentage", "condition": ">", "value": 50}, + "condition1": { + "clientmetric": "response_time_ms", + "aggregate": "avg", + "condition": ">", + "value": 300, + }, + "condition2": { + "clientmetric": "error", + "aggregate": "percentage", + "condition": ">", + "value": 50, + }, "condition3": { "clientmetric": "latency", "aggregate": "avg", @@ -319,7 +337,8 @@ def test_create_or_update_load_test(self, loadtesting_endpoint, loadtesting_test }, "secrets": {}, "environmentVariables": {"my-variable": "value"}, - }) + }, + ) assert result is not None @@ -331,7 +350,7 @@ def test_get_load_test(self, loadtesting_endpoint, loadtesting_test_id): client = self.create_administration_client(loadtesting_endpoint) result = client.get_test(loadtesting_test_id) assert result is not None - + @LoadTestingPreparer() @recorded_by_proxy def test_upload_test_file(self, loadtesting_endpoint, loadtesting_test_id): @@ -360,7 +379,9 @@ def test_get_test_file(self, loadtesting_endpoint, loadtesting_test_id): @LoadTestingPreparer() @recorded_by_proxy - def test_create_or_update_test_profile(self, loadtesting_endpoint, loadtesting_test_id, loadtesting_test_profile_id, loadtesting_target_resource_id): + def test_create_or_update_test_profile( + self, loadtesting_endpoint, loadtesting_test_id, loadtesting_test_profile_id, loadtesting_target_resource_id + ): set_bodiless_matcher() client = self.create_administration_client(loadtesting_endpoint) @@ -374,20 +395,14 @@ def test_create_or_update_test_profile(self, loadtesting_endpoint, loadtesting_t "targetResourceConfigurations": { "kind": "FunctionsFlexConsumption", "configurations": { - "config1": { - "instanceMemoryMB": 2048, - "httpConcurrency": 20 - }, - "config2": { - "instanceMemoryMB": 4096, - "httpConcurrency": 100 - }, - } - } + "config1": {"instanceMemoryMB": 2048, "httpConcurrency": 20}, + "config2": {"instanceMemoryMB": 4096, "httpConcurrency": 100}, + }, + }, }, ) assert result is not None - + @LoadTestingPreparer() @recorded_by_proxy def test_get_test_profile(self, loadtesting_endpoint, loadtesting_test_profile_id): @@ -399,7 +414,9 @@ def test_get_test_profile(self, loadtesting_endpoint, loadtesting_test_profile_i @LoadTestingPreparer() @recorded_by_proxy - def test_begin_test_profile_run(self, loadtesting_endpoint, loadtesting_test_profile_id, loadtesting_test_profile_run_id): + def test_begin_test_profile_run( + self, loadtesting_endpoint, loadtesting_test_profile_id, loadtesting_test_profile_run_id + ): set_bodiless_matcher() run_client = self.create_run_client(loadtesting_endpoint) @@ -428,7 +445,7 @@ def test_get_test_profile_run(self, loadtesting_endpoint, loadtesting_test_profi result = run_client.get_test_profile_run(loadtesting_test_profile_run_id) assert result is not None assert len(result["recommendations"]) > 0 - + @LoadTestingPreparer() @recorded_by_proxy def test_stop_test_profile_run(self, loadtesting_endpoint, loadtesting_test_profile_id): @@ -460,7 +477,7 @@ def test_delete_test_profile_run(self, loadtesting_endpoint, loadtesting_test_pr result = run_client.delete_test_profile_run(loadtesting_test_profile_run_id) assert result is None - + @LoadTestingPreparer() @recorded_by_proxy def test_delete_test_profile(self, loadtesting_endpoint, loadtesting_test_profile_id): diff --git a/sdk/loadtesting/azure-developer-loadtesting/tests/testcase.py b/sdk/loadtesting/azure-developer-loadtesting/tests/testcase.py index 08c5ecb92644..df4dc143934d 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/tests/testcase.py +++ b/sdk/loadtesting/azure-developer-loadtesting/tests/testcase.py @@ -38,5 +38,5 @@ def create_run_client(self, endpoint) -> LoadTestRunClient: loadtesting_app_component_id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Web/sites/contoso-sampleapp", loadtesting_test_profile_id="some-test-profile-id", loadtesting_target_resource_id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Web/sites/myFlexFunction", - loadtesting_test_profile_run_id="some-test-profile-run-id" + loadtesting_test_profile_run_id="some-test-profile-run-id", ) diff --git a/sdk/loadtesting/azure-developer-loadtesting/tests/testcase_async.py b/sdk/loadtesting/azure-developer-loadtesting/tests/testcase_async.py index e7ad3bfcd12c..7e256725c64a 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/tests/testcase_async.py +++ b/sdk/loadtesting/azure-developer-loadtesting/tests/testcase_async.py @@ -16,7 +16,7 @@ def create_administration_client(self, endpoint) -> LoadTestAdministrationClient credential=self.admin_credential, endpoint=endpoint, ) - + return self.admin_client def create_run_client(self, endpoint) -> LoadTestRunClient: @@ -28,11 +28,11 @@ def create_run_client(self, endpoint) -> LoadTestRunClient: ) return self.run_client - + async def close_admin_client(self): await self.admin_credential.close() await self.admin_client.close() - + async def close_run_client(self): await self.run_credential.close() await self.run_client.close() diff --git a/sdk/loadtesting/azure-developer-loadtesting/tsp-location.yaml b/sdk/loadtesting/azure-developer-loadtesting/tsp-location.yaml index f862b18befa1..8a4260fa89fc 100644 --- a/sdk/loadtesting/azure-developer-loadtesting/tsp-location.yaml +++ b/sdk/loadtesting/azure-developer-loadtesting/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/loadtestservice/LoadTestService -commit: 3582fd3aac7f024efda7e439acd84a83fc5ad3df +commit: 2ad82511706dc035660b16b4754eb4232a9fc4dc repo: Azure/azure-rest-api-specs additionalDirectories: