diff --git a/eng/http-client-csharp-emitter-package-lock.json b/eng/http-client-csharp-emitter-package-lock.json index e8d4fa922f7f..caec2a6af78c 100644 --- a/eng/http-client-csharp-emitter-package-lock.json +++ b/eng/http-client-csharp-emitter-package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "dependencies": { - "@azure-typespec/http-client-csharp": "1.0.0-alpha.20250423.1" + "@azure-typespec/http-client-csharp": "1.0.0-alpha.20250423.4" }, "devDependencies": { "@azure-tools/typespec-azure-core": "0.54.0", @@ -98,12 +98,12 @@ } }, "node_modules/@azure-typespec/http-client-csharp": { - "version": "1.0.0-alpha.20250423.1", - "resolved": "https://registry.npmjs.org/@azure-typespec/http-client-csharp/-/http-client-csharp-1.0.0-alpha.20250423.1.tgz", - "integrity": "sha512-tFZuwLfamPsjzo1ddjU8WFgo/cQSEdm8UUoVP5fCayE7pz+FkSFub12iKQgst+Snh3ke2DIPUi1+mK/+CnfjMA==", + "version": "1.0.0-alpha.20250423.4", + "resolved": "https://registry.npmjs.org/@azure-typespec/http-client-csharp/-/http-client-csharp-1.0.0-alpha.20250423.4.tgz", + "integrity": "sha512-Ky5XKSl6N6DGeSfKY5ASs6mG/a5+Z+jHvTwuZhIRRz8G3nF4ropaa0/vLNM2p3yF/WslgFxkMXboIyGl4/iCrg==", "license": "MIT", "dependencies": { - "@typespec/http-client-csharp": "1.0.0-alpha.20250421.4" + "@typespec/http-client-csharp": "1.0.0-alpha.20250422.2" } }, "node_modules/@babel/code-frame": { @@ -556,9 +556,9 @@ } }, "node_modules/@typespec/http-client-csharp": { - "version": "1.0.0-alpha.20250421.4", - "resolved": "https://registry.npmjs.org/@typespec/http-client-csharp/-/http-client-csharp-1.0.0-alpha.20250421.4.tgz", - "integrity": "sha512-YGSk8J3c5iI6GBI5H6+2rtziqyDwnaX0zaX3WXiGBhilf707fD/goU26jg474HXuz25RJvAO9qmctwYfI85tdA==", + "version": "1.0.0-alpha.20250422.2", + "resolved": "https://registry.npmjs.org/@typespec/http-client-csharp/-/http-client-csharp-1.0.0-alpha.20250422.2.tgz", + "integrity": "sha512-lMmmnqsDwOtKcTxEV5cZUkepHu6On0l78CxbxngHE+XjtXz74FhaVutQGsvJI15OtF0YGV/4XIQJ/3nRKzvp5g==", "license": "MIT", "dependencies": { "json-serialize-refs": "0.1.0-0" diff --git a/eng/http-client-csharp-emitter-package.json b/eng/http-client-csharp-emitter-package.json index f728230970b7..2c39856eb9ad 100644 --- a/eng/http-client-csharp-emitter-package.json +++ b/eng/http-client-csharp-emitter-package.json @@ -1,7 +1,7 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-typespec/http-client-csharp": "1.0.0-alpha.20250423.1" + "@azure-typespec/http-client-csharp": "1.0.0-alpha.20250423.4" }, "devDependencies": { "@azure-tools/typespec-azure-core": "0.54.0", diff --git a/sdk/loadtestservice/Azure.Developer.LoadTesting/tests/Generated/Samples/Samples_LoadTestAdministrationClient.cs b/sdk/loadtestservice/Azure.Developer.LoadTesting/tests/Generated/Samples/Samples_LoadTestAdministrationClient.cs new file mode 100644 index 000000000000..1e5efe887659 --- /dev/null +++ b/sdk/loadtestservice/Azure.Developer.LoadTesting/tests/Generated/Samples/Samples_LoadTestAdministrationClient.cs @@ -0,0 +1,774 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Developer.LoadTesting.Samples +{ + public partial class Samples_LoadTestAdministrationClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Test_CreateOrUpdateTest_CreateOrUpdateALoadTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + description = "sample description", + displayName = "Performance_LoadTest", + loadTestConfiguration = new + { + engineInstances = 6, + splitAllCSVs = true, + }, + passFailCriteria = new + { + passFailMetrics = new Dictionary + { + ["fefd759d-7fe8-4f83-8b6d-aeebe0f491fe"] = new + { + clientMetric = "response_time_ms", + aggregate = "percentage", + condition = ">", + value = 20, + action = "continue", + } + }, + passFailServerMetrics = new Dictionary + { + ["fefd759d-7fe8-4f83-8b6d-aeebe0f491fe"] = new + { + resourceId = "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines/MyVM", + metricNamespace = "Microsoft.Compute/virtualMachines", + metricName = "Percentage CPU", + aggregation = "Average", + condition = ">", + value = 20, + action = "continue", + } + }, + }, + autoStopCriteria = new + { + autoStopDisabled = true, + errorRate = 70F, + errorRateTimeWindowInSeconds = 60, + }, + secrets = new + { + secret1 = new + { + value = "https://samplevault.vault.azure.net/secrets/samplesecret/f113f91fd4c44a368049849c164db827", + type = "AKV_SECRET_URI", + }, + }, + environmentVariables = new + { + envvar1 = "sampletext", + }, + subnetId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Network/virtualNetworks/samplenetworkresource/subnets/AAAAA0A0A0", + keyvaultReferenceIdentityType = "UserAssigned", + keyvaultReferenceIdentityId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/sampleprovider/sampleresourcetype/sampleresourcename", + metricsReferenceIdentityType = "UserAssigned", + metricsReferenceIdentityId = "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/samplerg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sampleresourcename", + engineBuiltInIdentityType = "UserAssigned", + engineBuiltInIdentityIds = new object[] + { +"/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/samplerg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sampleresourcename" + }, + }); + Response response = client.CreateOrUpdateTest("12345678-1234-1234-1234-123456789012", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Test_CreateOrUpdateTest_CreateOrUpdateALoadTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + description = "sample description", + displayName = "Performance_LoadTest", + loadTestConfiguration = new + { + engineInstances = 6, + splitAllCSVs = true, + }, + passFailCriteria = new + { + passFailMetrics = new Dictionary + { + ["fefd759d-7fe8-4f83-8b6d-aeebe0f491fe"] = new + { + clientMetric = "response_time_ms", + aggregate = "percentage", + condition = ">", + value = 20, + action = "continue", + } + }, + passFailServerMetrics = new Dictionary + { + ["fefd759d-7fe8-4f83-8b6d-aeebe0f491fe"] = new + { + resourceId = "/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines/MyVM", + metricNamespace = "Microsoft.Compute/virtualMachines", + metricName = "Percentage CPU", + aggregation = "Average", + condition = ">", + value = 20, + action = "continue", + } + }, + }, + autoStopCriteria = new + { + autoStopDisabled = true, + errorRate = 70F, + errorRateTimeWindowInSeconds = 60, + }, + secrets = new + { + secret1 = new + { + value = "https://samplevault.vault.azure.net/secrets/samplesecret/f113f91fd4c44a368049849c164db827", + type = "AKV_SECRET_URI", + }, + }, + environmentVariables = new + { + envvar1 = "sampletext", + }, + subnetId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Network/virtualNetworks/samplenetworkresource/subnets/AAAAA0A0A0", + keyvaultReferenceIdentityType = "UserAssigned", + keyvaultReferenceIdentityId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/sampleprovider/sampleresourcetype/sampleresourcename", + metricsReferenceIdentityType = "UserAssigned", + metricsReferenceIdentityId = "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/samplerg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sampleresourcename", + engineBuiltInIdentityType = "UserAssigned", + engineBuiltInIdentityIds = new object[] + { +"/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/samplerg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/sampleresourcename" + }, + }); + Response response = await client.CreateOrUpdateTestAsync("12345678-1234-1234-1234-123456789012", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AdministrationOperations_CreateOrUpdateAppComponents_AddOrUpdateAppComponentsToALoadTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + components = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource"] = new + { + resourceType = "microsoft.insights/components", + resourceName = "appcomponentresource", + displayName = "Performance_LoadTest_Insights", + kind = "web", + } + }, + }); + Response response = client.CreateOrUpdateAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AdministrationOperations_CreateOrUpdateAppComponents_AddOrUpdateAppComponentsToALoadTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + components = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource"] = new + { + resourceType = "microsoft.insights/components", + resourceName = "appcomponentresource", + displayName = "Performance_LoadTest_Insights", + kind = "web", + } + }, + }); + Response response = await client.CreateOrUpdateAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AdministrationOperations_CreateOrUpdateServerMetricsConfig_AddOrUpdateServerMetricsConfigurationForALoadTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + metrics = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration"] = new + { + resourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource", + metricNamespace = "microsoft.insights/components", + displayDescription = "sample description", + name = "requests/duration", + aggregation = "Average", + resourceType = "microsoft.insights/components", + } + }, + }); + Response response = client.CreateOrUpdateServerMetricsConfig("edc6e529-d009-4b99-b763-ca492e3a2823", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("metricNamespace").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("aggregation").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AdministrationOperations_CreateOrUpdateServerMetricsConfig_AddOrUpdateServerMetricsConfigurationForALoadTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + metrics = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration"] = new + { + resourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource", + metricNamespace = "microsoft.insights/components", + displayDescription = "sample description", + name = "requests/duration", + aggregation = "Average", + resourceType = "microsoft.insights/components", + } + }, + }); + Response response = await client.CreateOrUpdateServerMetricsConfigAsync("edc6e529-d009-4b99-b763-ca492e3a2823", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("metricNamespace").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("aggregation").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AdministrationOperations_GetAppComponents_GetAssociatedAppComponentForTheGivenTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AdministrationOperations_GetAppComponents_GetAssociatedAppComponentForTheGivenTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AdministrationOperations_GetAppComponents_GetAssociatedAppComponentForTheGivenTest_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AdministrationOperations_GetAppComponents_GetAssociatedAppComponentForTheGivenTest_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AdministrationOperations_GetServerMetricsConfig_ListServerMetricsConfigurationForTheGivenTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetServerMetricsConfig("12345678-1234-1234-1234-123456789012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("metricNamespace").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("aggregation").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AdministrationOperations_GetServerMetricsConfig_ListServerMetricsConfigurationForTheGivenTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetServerMetricsConfigAsync("12345678-1234-1234-1234-123456789012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("metricNamespace").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("aggregation").ToString()); + Console.WriteLine(result.GetProperty("metrics").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AdministrationOperations_GetServerMetricsConfig_ListServerMetricsConfigurationForTheGivenTest_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetServerMetricsConfig("12345678-1234-1234-1234-123456789012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AdministrationOperations_GetServerMetricsConfig_ListServerMetricsConfigurationForTheGivenTest_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetServerMetricsConfigAsync("12345678-1234-1234-1234-123456789012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Test_GetTest_GetALoadTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetTest("12345678-1234-1234-1234-123456789012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Test_GetTest_GetALoadTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetTestAsync("12345678-1234-1234-1234-123456789012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Test_GetTest_GetALoadTest_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetTest("12345678-1234-1234-1234-123456789012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Test_GetTest_GetALoadTest_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetTestAsync("12345678-1234-1234-1234-123456789012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestFileInfo_GetTestFile_GetAFileFromALoadTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetTestFile("12345678-1234-1234-1234-123456789012", "sample.jmx", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("fileName").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestFileInfo_GetTestFile_GetAFileFromALoadTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetTestFileAsync("12345678-1234-1234-1234-123456789012", "sample.jmx", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("fileName").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestFileInfo_GetTestFile_GetAFileFromALoadTest_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetTestFile("12345678-1234-1234-1234-123456789012", "sample.jmx"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestFileInfo_GetTestFile_GetAFileFromALoadTest_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetTestFileAsync("12345678-1234-1234-1234-123456789012", "sample.jmx"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestFileInfo_DeleteTestFile_DeleteAFileFromALoadTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.DeleteTestFile("12345678-1234-1234-1234-123456789012", "app.jmx"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestFileInfo_DeleteTestFile_DeleteAFileFromALoadTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.DeleteTestFileAsync("12345678-1234-1234-1234-123456789012", "app.jmx"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Test_DeleteTest_DeleteALoadTest() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.DeleteTest("12345678-1234-1234-1234-123456789012"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Test_DeleteTest_DeleteALoadTest_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.DeleteTestAsync("12345678-1234-1234-1234-123456789012"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfile_CreateOrUpdateTestProfile_CreateOrUpdateATestProfile() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + description = "sample description", + displayName = "Performance_TestProfile", + testId = "12346-abcd-6789", + targetResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Web/sites/myfunctionapp", + targetResourceConfigurations = new + { + kind = "FunctionsFlexConsumption", + configurations = new + { + config1 = new + { + instanceMemoryMB = 2048L, + httpConcurrency = 16L, + }, + config2 = new + { + instanceMemoryMB = 4096L, + httpConcurrency = 16L, + }, + }, + }, + }); + Response response = client.CreateOrUpdateTestProfile("12345678-1234-1234-1234-123456789012", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfile_CreateOrUpdateTestProfile_CreateOrUpdateATestProfile_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + description = "sample description", + displayName = "Performance_TestProfile", + testId = "12346-abcd-6789", + targetResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/Microsoft.Web/sites/myfunctionapp", + targetResourceConfigurations = new + { + kind = "FunctionsFlexConsumption", + configurations = new + { + config1 = new + { + instanceMemoryMB = 2048L, + httpConcurrency = 16L, + }, + config2 = new + { + instanceMemoryMB = 4096L, + httpConcurrency = 16L, + }, + }, + }, + }); + Response response = await client.CreateOrUpdateTestProfileAsync("12345678-1234-1234-1234-123456789012", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfile_DeleteTestProfile_DeleteATestProfile() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.DeleteTestProfile("12345678-1234-1234-1234-123456789012"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfile_DeleteTestProfile_DeleteATestProfile_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.DeleteTestProfileAsync("12345678-1234-1234-1234-123456789012"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfile_GetTestProfile_GetATestProfile() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetTestProfile("12345678-1234-1234-1234-123456789012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfile_GetTestProfile_GetATestProfile_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetTestProfileAsync("12345678-1234-1234-1234-123456789012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfile_GetTestProfile_GetATestProfile_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = client.GetTestProfile("12345678-1234-1234-1234-123456789012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfile_GetTestProfile_GetATestProfile_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + Response response = await client.GetTestProfileAsync("12345678-1234-1234-1234-123456789012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestFileInfo_GetTestFiles_GetAllTestFiles() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + foreach (BinaryData item in client.GetTestFiles("12345678-1234-1234-1234-123456789012", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("fileName").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestFileInfo_GetTestFiles_GetAllTestFiles_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + await foreach (BinaryData item in client.GetTestFilesAsync("12345678-1234-1234-1234-123456789012", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("fileName").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestFileInfo_GetTestFiles_GetAllTestFiles_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + foreach (TestFileInfo item in client.GetTestFiles("12345678-1234-1234-1234-123456789012")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestFileInfo_GetTestFiles_GetAllTestFiles_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestAdministrationClient client = new LoadTestAdministrationClient(endpoint, credential); + + await foreach (TestFileInfo item in client.GetTestFilesAsync("12345678-1234-1234-1234-123456789012")) + { + } + } + } +} diff --git a/sdk/loadtestservice/Azure.Developer.LoadTesting/tests/Generated/Samples/Samples_LoadTestRunClient.cs b/sdk/loadtestservice/Azure.Developer.LoadTesting/tests/Generated/Samples/Samples_LoadTestRunClient.cs new file mode 100644 index 000000000000..78875c72939f --- /dev/null +++ b/sdk/loadtestservice/Azure.Developer.LoadTesting/tests/Generated/Samples/Samples_LoadTestRunClient.cs @@ -0,0 +1,832 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Developer.LoadTesting.Samples +{ + public partial class Samples_LoadTestRunClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_CreateOrUpdateAppComponents_AddOrUpdateAppComponentsToALoadTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + components = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource"] = new + { + resourceType = "microsoft.insights/components", + resourceName = "appcomponentresource", + displayName = "Performance_LoadTest_Insights", + kind = "web", + } + }, + }); + Response response = client.CreateOrUpdateAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_CreateOrUpdateAppComponents_AddOrUpdateAppComponentsToALoadTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + components = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource"] = new + { + resourceType = "microsoft.insights/components", + resourceName = "appcomponentresource", + displayName = "Performance_LoadTest_Insights", + kind = "web", + } + }, + }); + Response response = await client.CreateOrUpdateAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_CreateOrUpdateServerMetricsConfig_AddOrUpdateServerMetricsConfigurationForALoadTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + metrics = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration"] = new + { + resourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource", + metricNamespace = "microsoft.insights/components", + displayDescription = "sample description", + name = "requests/duration", + aggregation = "Average", + resourceType = "microsoft.insights/components", + } + }, + }); + Response response = client.CreateOrUpdateServerMetricsConfig("edc6e529-d009-4b99-b763-ca492e3a2823", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_CreateOrUpdateServerMetricsConfig_AddOrUpdateServerMetricsConfigurationForALoadTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + metrics = new Dictionary + { + ["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource/providers/microsoft.insights/metricdefinitions/requests/duration"] = new + { + resourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/samplerg/providers/microsoft.insights/components/appcomponentresource", + metricNamespace = "microsoft.insights/components", + displayDescription = "sample description", + name = "requests/duration", + aggregation = "Average", + resourceType = "microsoft.insights/components", + } + }, + }); + Response response = await client.CreateOrUpdateServerMetricsConfigAsync("edc6e529-d009-4b99-b763-ca492e3a2823", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRun_DeleteTestRun_DeleteALoadTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.DeleteTestRun("12316678-1234-1234-1234-122451189012"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRun_DeleteTestRun_DeleteALoadTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.DeleteTestRunAsync("12316678-1234-1234-1234-122451189012"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetAppComponents_GetAssociatedAppComponentForTheGivenTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetAppComponents_GetAssociatedAppComponentForTheGivenTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceName").ToString()); + Console.WriteLine(result.GetProperty("components").GetProperty("").GetProperty("resourceType").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetAppComponents_GetAssociatedAppComponentForTheGivenTestRun_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetAppComponents("ee843bd9-a6d4-4364-a45c-427a03c39fa7"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetAppComponents_GetAssociatedAppComponentForTheGivenTestRun_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetAppComponentsAsync("ee843bd9-a6d4-4364-a45c-427a03c39fa7"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetServerMetricsConfig_ListServerMetricsConfigurationForTheGivenTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetServerMetricsConfig("12345678-1234-1234-1234-123456789012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetServerMetricsConfig_ListServerMetricsConfigurationForTheGivenTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetServerMetricsConfigAsync("12345678-1234-1234-1234-123456789012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetServerMetricsConfig_ListServerMetricsConfigurationForTheGivenTestRun_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetServerMetricsConfig("12345678-1234-1234-1234-123456789012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetServerMetricsConfig_ListServerMetricsConfigurationForTheGivenTestRun_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetServerMetricsConfigAsync("12345678-1234-1234-1234-123456789012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRun_GetTestRun_GetALoadTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetTestRun("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRun_GetTestRun_GetALoadTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetTestRunAsync("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRun_GetTestRun_GetALoadTestRun_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetTestRun("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRun_GetTestRun_GetALoadTestRun_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetTestRunAsync("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunFileInfo_GetTestRunFile_GetAFileAssociatedToALoadTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetTestRunFile("12316678-1234-1234-1234-122451189012", "sample.jmx", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("fileName").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunFileInfo_GetTestRunFile_GetAFileAssociatedToALoadTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetTestRunFileAsync("12316678-1234-1234-1234-122451189012", "sample.jmx", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("fileName").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunFileInfo_GetTestRunFile_GetAFileAssociatedToALoadTestRun_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetTestRunFile("12316678-1234-1234-1234-122451189012", "sample.jmx"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunFileInfo_GetTestRunFile_GetAFileAssociatedToALoadTestRun_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetTestRunFileAsync("12316678-1234-1234-1234-122451189012", "sample.jmx"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetMetricDefinitions_ListTheMetricDefinitionsForALoadTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetMetricDefinitions("12316678-1234-1234-1234-122451189012", "LoadTestRunMetrics", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetMetricDefinitions_ListTheMetricDefinitionsForALoadTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetMetricDefinitionsAsync("12316678-1234-1234-1234-122451189012", "LoadTestRunMetrics", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetMetricDefinitions_ListTheMetricDefinitionsForALoadTestRun_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetMetricDefinitions("12316678-1234-1234-1234-122451189012", "LoadTestRunMetrics"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetMetricDefinitions_ListTheMetricDefinitionsForALoadTestRun_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetMetricDefinitionsAsync("12316678-1234-1234-1234-122451189012", "LoadTestRunMetrics"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetMetricNamespaces_ListTheMetricNamespacesForALoadTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetMetricNamespaces("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetMetricNamespaces_ListTheMetricNamespacesForALoadTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetMetricNamespacesAsync("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("value")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetMetricNamespaces_ListTheMetricNamespacesForALoadTestRun_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetMetricNamespaces("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetMetricNamespaces_ListTheMetricNamespacesForALoadTestRun_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetMetricNamespacesAsync("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_StopTestRun_StopTestRunByName() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.StopTestRun("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_StopTestRun_StopTestRunByName_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.StopTestRunAsync("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_StopTestRun_StopTestRunByName_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.StopTestRun("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_StopTestRun_StopTestRunByName_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.StopTestRunAsync("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfileRun_DeleteTestProfileRun_DeletesATestProfileRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.DeleteTestProfileRun("12316678-1234-1234-1234-122451189012"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfileRun_DeleteTestProfileRun_DeletesATestProfileRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.DeleteTestProfileRunAsync("12316678-1234-1234-1234-122451189012"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfileRun_GetTestProfileRun_GetATestProfileRunAfterTheRunHasExecuted() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetTestProfileRun("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfileRun_GetTestProfileRun_GetATestProfileRunAfterTheRunHasExecuted_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetTestProfileRunAsync("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfileRun_GetTestProfileRun_GetATestProfileRunAfterTheRunHasExecuted_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetTestProfileRun("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfileRun_GetTestProfileRun_GetATestProfileRunAfterTheRunHasExecuted_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetTestProfileRunAsync("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfileRun_GetTestProfileRun_GetATestProfileRunWhileTheRunIsExecuting() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetTestProfileRun("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfileRun_GetTestProfileRun_GetATestProfileRunWhileTheRunIsExecuting_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetTestProfileRunAsync("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestProfileRun_GetTestProfileRun_GetATestProfileRunWhileTheRunIsExecuting_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.GetTestProfileRun("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestProfileRun_GetTestProfileRun_GetATestProfileRunWhileTheRunIsExecuting_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.GetTestProfileRunAsync("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_StopTestProfileRun_StopATestProfileRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.StopTestProfileRun("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_StopTestProfileRun_StopATestProfileRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.StopTestProfileRunAsync("12316678-1234-1234-1234-122451189012", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("testProfileRunId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_StopTestProfileRun_StopATestProfileRun_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = client.StopTestProfileRun("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_StopTestProfileRun_StopATestProfileRun_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + Response response = await client.StopTestProfileRunAsync("12316678-1234-1234-1234-122451189012"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetMetricDimensionValues_ListTheDimensionValuesForTheGivenMetricDimensionName() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + foreach (BinaryData item in client.GetMetricDimensionValues("12316678-1234-1234-1234-122451189012", "SamplerName", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z", "PT1H", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetMetricDimensionValues_ListTheDimensionValuesForTheGivenMetricDimensionName_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + await foreach (BinaryData item in client.GetMetricDimensionValuesAsync("12316678-1234-1234-1234-122451189012", "SamplerName", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z", "PT1H", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetMetricDimensionValues_ListTheDimensionValuesForTheGivenMetricDimensionName_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + foreach (string item in client.GetMetricDimensionValues("12316678-1234-1234-1234-122451189012", "SamplerName", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetMetricDimensionValues_ListTheDimensionValuesForTheGivenMetricDimensionName_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + await foreach (string item in client.GetMetricDimensionValuesAsync("12316678-1234-1234-1234-122451189012", "SamplerName", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetMetrics_ListTheMetricValuesForALoadTestRun() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + filters = new object[] + { +new +{ +name = "SamplerName", +values = new object[] +{ +"HTTP Request" +}, +} + }, + }); + foreach (BinaryData item in client.GetMetrics("12316678-1234-1234-1234-122451189012", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z", content)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetMetrics_ListTheMetricValuesForALoadTestRun_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + filters = new object[] + { +new +{ +name = "SamplerName", +values = new object[] +{ +"HTTP Request" +}, +} + }, + }); + await foreach (BinaryData item in client.GetMetricsAsync("12316678-1234-1234-1234-122451189012", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z", content)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_TestRunOperations_GetMetrics_ListTheMetricValuesForALoadTestRun_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + foreach (TimeSeriesElement item in client.GetMetrics("12316678-1234-1234-1234-122451189012", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_TestRunOperations_GetMetrics_ListTheMetricValuesForALoadTestRun_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + LoadTestRunClient client = new LoadTestRunClient(endpoint, credential); + + await foreach (TimeSeriesElement item in client.GetMetricsAsync("12316678-1234-1234-1234-122451189012", "ActiveThreads", "LoadTestRunMetrics", "2022-09-24T19:00:40Z/2022-09-25T19:28:40Z")) + { + } + } + } +}