LoadTestAdministrationClient.CreateOrUpdateAppComponents Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Associate an app component (collection of azure resources) to a test.
public virtual Azure.Response CreateOrUpdateAppComponents (string testId, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreateOrUpdateAppComponents : string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.CreateOrUpdateAppComponents : string * Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function CreateOrUpdateAppComponents (testId As String, content As RequestContent, Optional context As RequestContext = Nothing) As Response
Parameters
- testId
- String
Unique name for the load test, must contain only lower-case alphabetic, numeric, underscore or hyphen characters.
- content
- RequestContent
The content to send as the body of the request. Details of the request body schema are in the Remarks section below.
- 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. Details of the response body schema are in the Remarks section below.
Exceptions
testId
or content
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 CreateOrUpdateAppComponents with required parameters and request content and parse the result.
var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new LoadTestAdministrationClient(endpoint, credential);
var data = new {
components = new {
key = new {
resourceName = "<resourceName>",
resourceType = "<resourceType>",
displayName = "<displayName>",
kind = "<kind>",
},
},
};
Response response = client.CreateOrUpdateAppComponents("<testId>", RequestContent.Create(data));
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("components").GetProperty("<test>").GetProperty("resourceId").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<test>").GetProperty("resourceName").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<test>").GetProperty("resourceType").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<test>").GetProperty("displayName").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<test>").GetProperty("resourceGroup").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<test>").GetProperty("subscriptionId").ToString());
Console.WriteLine(result.GetProperty("components").GetProperty("<test>").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 request and response payloads.
Request 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.
}
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.
}