Share via


LoadTestRunClient.GetAppComponents Method

Definition

Overloads

GetAppComponents(String, RequestContext)

[Protocol Method] Get associated app component (collection of azure resources) for the given test run.

GetAppComponents(String, CancellationToken)

Get associated app component (collection of azure resources) for the given test run.

GetAppComponents(String, RequestContext)

Source:
LoadTestRunClient.cs
Source:
LoadTestRunClient.cs

[Protocol Method] Get associated app component (collection of azure resources) for the given test run.

public virtual Azure.Response GetAppComponents(string testRunId, Azure.RequestContext context = default);
public virtual Azure.Response GetAppComponents(string testRunId, Azure.RequestContext context);
abstract member GetAppComponents : string * Azure.RequestContext -> Azure.Response
override this.GetAppComponents : string * Azure.RequestContext -> Azure.Response
Public Overridable Function GetAppComponents (testRunId As String, Optional context As RequestContext = Nothing) As Response
Public Overridable Function GetAppComponents (testRunId As String, context As RequestContext) As Response

Parameters

testRunId
String

Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

testRunId is null.

testRunId is an empty string, and was expected to be non-empty.

Service returned a non-success status code.

Examples

This sample shows how to call GetAppComponents and parse the result.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
LoadTestRunClient client = new LoadTestRunClient(endpoint, credential);

Response response = client.GetAppComponents("<testRunId>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("components").GetProperty("<key>").ToString());

This sample shows how to call GetAppComponents with all parameters and parse the result.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
LoadTestRunClient client = new LoadTestRunClient(endpoint, credential);

Response response = client.GetAppComponents("<testRunId>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("components").GetProperty("<key>").GetProperty("resourceId").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<key>").GetProperty("resourceName").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<key>").GetProperty("resourceType").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<key>").GetProperty("displayName").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<key>").GetProperty("resourceGroup").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<key>").GetProperty("subscriptionId").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<key>").GetProperty("kind").ToString());
Console.WriteLine(result.GetProperty("testRunId").ToString());
Console.WriteLine(result.GetProperty("createdDateTime").ToString());
Console.WriteLine(result.GetProperty("createdBy").ToString());
Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString());
Console.WriteLine(result.GetProperty("lastModifiedBy").ToString());

Remarks

Below is the JSON schema for the response payload.

Response Body:

Schema for TestRunAppComponents:

{
  components: Dictionary<string, AppComponent>, # Required. Azure resource collection { resource id (fully qualified resource Id e.g subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName}) : resource object } 
  testRunId: string, # Optional. Test run identifier
  createdDateTime: string (ISO 8601 Format), # Optional. The creation datetime(ISO 8601 literal format).
  createdBy: string, # Optional. The user that created.
  lastModifiedDateTime: string (ISO 8601 Format), # Optional. The last Modified datetime(ISO 8601 literal format).
  lastModifiedBy: string, # Optional. The user that last modified.
}

Applies to

GetAppComponents(String, CancellationToken)

Source:
LoadTestRunClient.cs

Get associated app component (collection of azure resources) for the given test run.

public virtual Azure.Response<Azure.Developer.LoadTesting.TestRunAppComponents> GetAppComponents(string testRunId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetAppComponents : string * System.Threading.CancellationToken -> Azure.Response<Azure.Developer.LoadTesting.TestRunAppComponents>
override this.GetAppComponents : string * System.Threading.CancellationToken -> Azure.Response<Azure.Developer.LoadTesting.TestRunAppComponents>
Public Overridable Function GetAppComponents (testRunId As String, Optional cancellationToken As CancellationToken = Nothing) As Response(Of TestRunAppComponents)

Parameters

testRunId
String

Unique name for the load test run, must contain only lower-case alphabetic, numeric, underscore or hyphen characters.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

testRunId is null.

testRunId is an empty string, and was expected to be non-empty.

Applies to