Condividi tramite


LoadTestAdministrationClient.GetAppComponentsAsync Method

Definition

Overloads

Name Description
GetAppComponentsAsync(String, RequestContext)

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

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
GetAppComponentsAsync(String, CancellationToken)

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

GetAppComponentsAsync(String, RequestContext)

Source:
LoadTestAdministrationClient.cs
Source:
LoadTestAdministrationClient.cs

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

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual System.Threading.Tasks.Task<Azure.Response> GetAppComponentsAsync(string testId, Azure.RequestContext context = default);
public virtual System.Threading.Tasks.Task<Azure.Response> GetAppComponentsAsync(string testId, Azure.RequestContext context);
abstract member GetAppComponentsAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetAppComponentsAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetAppComponentsAsync (testId As String, Optional context As RequestContext = Nothing) As Task(Of Response)
Public Overridable Function GetAppComponentsAsync (testId As String, context As RequestContext) As Task(Of Response)

Parameters

testId
String

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

context
RequestContext

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

Returns

The response returned from the service.

Exceptions

testId is null.

testId 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 GetAppComponentsAsync and parse the result.

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

Response response = await client.GetAppComponentsAsync("<testId>");

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

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

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

Response response = await client.GetAppComponentsAsync("<testId>");

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("testId").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 TestAppComponents:

{
  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 } 
  testId: string, # Optional. Test 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

GetAppComponentsAsync(String, CancellationToken)

Source:
LoadTestAdministrationClient.cs

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

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

Parameters

testId
String

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

cancellationToken
CancellationToken

The cancellation token that can be used to cancel the operation.

Returns

Exceptions

testId is null.

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

Service returned a non-success status code.

Applies to